Click here to Skip to main content
15,887,874 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have been working on one complex custom server control. There are more then 20 classes in this project.


I build the project and add custom control in .aspx page. I also put one button control in page.


Now On button click event, I assign one custom control property but it does not affect on result because createchildcontrol
event fires first before button click event.


I was surprised. I was sure this should not happen so I create new custom control project and put in page and take one button
control. But here createchildcontrol event fires after button click event and property is also affected on button click event.


Can anyone tell me why createchildcontrol event fires first before button click event in first case?


Regard
Imrankhan
Posted

From a quick google I think you need to call EnsureChildControls in the LoadViewState method.
 
Share this answer
 
Thanks Christian Graus.

I will try and let you know.

But in second case, Why createchildcontrol method calls after button event?

Regard
Imrankhan
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900