.net - c# Panel subpanel and button -
i created user controls duplicate standard button , 2 different panels
let’s say:
the panel 1: p1 button b panel 2: p2 button b once form created, there b in p1 , b in p2, shown above. b needs have action if in p1 , action if in p2
do knows if b can understand if in p1 or p2 ?
i instanced p1 , p2 not change fact catches or not inside panel.
hope work you.for time being using single button control in usercontrol :
ascx file :
<%@ control language="c#" autoeventwireup="true" codefile="buttonl.ascx.cs"inherits="controls_buttonl" %> <asp:button id="button1" runat="server" text="button user control" onclick="button1_click" /> ascx.cs file :
protected void button1_click(object sender, eventargs e) { if (this.id == "buttonl1") { //perform action according panel1 } else if (this.id == "buttonl2") { //perform action according panel2 } } aspx page (parentpage) :
<form id="form1" runat="server"> <div> <asp:panel id="panel1" runat="server" height="99px" width="224px"> <uc1:buttonl id="buttonl1" runat="server" /> </asp:panel> </div> <div> <asp:panel id="panel2" runat="server" height="97px" width="222px"> <uc1:buttonl id="buttonl2" runat="server" /> </asp:panel> </div> </form> please let me know if still not able reach target.
Comments
Post a Comment