.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

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -