concept problem webcustomcontrols

J

josemari

Hi to the forum..

i have a project with this webcontrol

Webcontrol
_______________________
|
|initialize component
| button +=new event.....
| controls.add(button) |
|
|event onclick
| new webcontrol2
| -control.add(webcontrol2)
---------------------------------

webcontrol
____________________________
|
| InitializeComponent
| button2 +=new EventHandler...
| -controls.add(textbox)
| -controls.add(button2)
| Onclick
| Response.write("hello")
----------------------------------------

Somebody knows why when i click the button2, all the webcontrol dissapear from and dont show the word "hello"

Anybody knows how could i solve this problem??..
Thanks in advanc
Regard
Josemar
 
T

Teemu Keiski

I didn't get very clear picture what is going, but it would seem that you'd
add the Button2 in click event handler for the Button1 and that is too late
to add controls, if they participate postback data processing. Control would
need to be added on Page_Load in the same order on every request so that it
would work as expected.

You might also want to have a look at Denis Bauer's free
DynamicControlPlaceHolder control which can automate this task for you.

http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx
 

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

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top