Hi Localhost,
I agree with Avnrao's suggestions that both Page_load and the Init event is
ok to add the dynamic created control and wire their event handler( but we
need to add the control and wire event handler for it everytime the page is
loaded ). And as for the time when to wire up the event handler, the Init
or Load is both ok because as long as we wire up the event handler before
the page processing the serverside controls post back events(it is after
the Page_load) the event will be correctly fired and call the handler. For
detailed info on the asp.net page's serverside event life cycle, you may
view the following article:
#The ASP.NET Page Object Model
http://msdn.microsoft.com/library/en...eobjectmodel.a
sp?frame=true
And the following twos are the reference on creating dynamic controls on
asp.net webform:
#Adding Controls to a Web Forms Page Programmatically
http://msdn.microsoft.com/library/en...controlstowebf
ormspageprogrammatically.asp?frame=true
#HOW TO: Dynamically Create Controls in ASP.NET by Using Visual C# .NET
http://support.microsoft.com/?id=317794
Hope also helps. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx