<asp:UpdatePanel ID="dd" runat="server" > <ContentTemplate> <asp:Button ID="AddToCart" runat = "server" Text='Add to Cart' BackColor="DarkSlateBlue" Width="100px" Style=" font-family:Arial" ForeColor="White" 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:modalpopupextender id="ModalPopupExtender1" runat="server" cancelcontrolid="btnCancel" okcontrolid="btnOkay" targetcontrolid="BtnDetails" popupcontrolid="Lbldetails" popupdraghandlecontrolid="PopupHeader" drag="true" backgroundcssclass="ModalPopupBG"> </asp:modalpopupextender> <asp:Label id="Lbldetails" style="display: none" runat="server"> <div class="HellowWorldPopup"> <div class="PopupHeader" id="PopupHeader">Header</div> <div class="PopupBody"> <p>This is a simple modal dialog</p> </div> <div class="Controls"> <input id="btnOkay" type="button" value="Done" /> <input id="btnCancel" type="button" value="Cancel" /> </div> </div> </asp:Label> </ContentTemplate> </asp:UpdatePanel>
if (e.CommandName == "myeventDetails") // check commandname here { int index = e.Item.ItemIndex; 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 = v_descriptionstatic; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)