use this.controls.add inside an onclick event

G

Guest

Hi to all,

i have a web custom control(webcontrol1) that has a button(button1), another webcontrol(webcontrol2) that has a label (label1), and another webcontrol (webcontrol_all).

in the webcontrol_all i make this steps:
1) i instanciate the button (protected webcontrol1 mywebcontrol = new webcontrol1)
2) i instanciate the second webcontrol(protected webcontrol2 mywebcontrol2 = new webcontrol2)
3) create the event Onclick (mywebcontrol.button1.click +=new systemeventhandler....)
4) private void button1.click{this.Controls.add(webcontrol2)}
My problem is that the webcontrol2 its added, if i add for example a button from the toolbar (a normal button), and i make clickon it in the browser, my webcontrol2 dissapear, i dont know why...

Could you send me anything, would be grateful...
Thanks.
Josema.
 
D

Dmitriy Lapshin [C# / .NET MVP]

Yet another idea - put the control you want to show/hide dynamically inside
asp:panel and turn the panel's Visible property on or off.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Josema said:
Hi to all,

i have a web custom control(webcontrol1) that has a button(button1),
another webcontrol(webcontrol2) that has a label (label1), and another
webcontrol (webcontrol_all).
in the webcontrol_all i make this steps:
1) i instanciate the button (protected webcontrol1 mywebcontrol = new webcontrol1)
2) i instanciate the second webcontrol(protected webcontrol2
mywebcontrol2 = new webcontrol2)
3) create the event Onclick (mywebcontrol.button1.click +=new systemeventhandler....)
4) private void button1.click{this.Controls.add(webcontrol2)}
My problem is that the webcontrol2 its added, if i add for example a
button from the toolbar (a normal button), and i make clickon it in the
browser, my webcontrol2 dissapear, i dont know why...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top