<asp:DataList ID="DataList1" runat="server" BackColor="White" Width="220" BorderStyle="None" BorderWidth="2" OnItemCommand="dl_item_command" RepeatColumns="3" style=" border-top-style:groove; border-top-color:Lime; border-left-width:medium;" RepeatDirection="Horizontal" > <asp:UpdatePanel ID="dd" runat="server" > <ContentTemplate> <asp:Button ID="AddToCart" runat = "server" Text='Add to Cart' BackColor="#cccccc" Width="100px" Style=" font-family:Arial" ForeColor="#333333" commandname="myevent"> </asp:Button> <asp:Button ID="BtnDetails" runat = "server" Text='Details' BackColor="DarkSlateBlue" Width="100px" Style=" font-family:Arial" ForeColor="White" commandname="myeventDetails"> </asp:Button> <asp:Label ID="Lbldetails" runat="server" Visible="false" Height="197" BackColor="Black" ForeColor="GhostWhite" style=" size:auto; overflow:auto; position:absolute; width:246px"> </asp:Label>
if (e.CommandName == "myeventDetails") // check commandname here { int index = e.Item.ItemIndex; // Button dd = (Button)DataList1.Items[index].FindControl("BtnDetails"); Label lbl1 = (Label)DataList1.Items[index].FindControl("lblProductId"); v_code = Convert.ToInt32(lbl1.Text); Label CategoryLbl = (Label)DataList1.Items[index].FindControl("CategoryLbl"); v_categoryid = Convert.ToInt32(CategoryLbl.Text); SqlCommand cmd4 = new SqlCommand("SELECT DescriptionStatic from product WHERE CategoryId='" + v_categoryid + "' and ProductId='" + v_code + "'", con); SqlParameter param4 = new SqlParameter(); param4.ParameterName = "@v_mem_id1"; param4.Value = "ss"; cmd4.Parameters.Add(param4); con.Open(); SqlDataReader reader1 = cmd4.ExecuteReader(); if (reader1.HasRows) { while (reader1.Read()) { string v_descriptionstatic = reader1.GetString(0); Lbldetails.Text = Convert.ToString(v_descriptionstatic); //Lbldetails.Style[HtmlTextWriterStyle.Top] = "610px"; Lbldetails.Visible = true;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)