i am creating a webcontrol in a webcontrol library
in the constructor of the control i have created all the controls i need and i have one of these controls as a datagrid which calls a few methods and then i call its DataBind()
i have two events attached to it itemdatabound
and the other is itemcommand which neverfires as everytime the page containing the control always calls the databind of the control...
and when i try to use page.ispostback in the control constructor always it fails with a null reference exception on the page object
The page might not have been initialized when the control's constructor fires. Do not add the controls in the constructor of the control. I think you should build a CompositeControl and add the child controls in the CreateChildControls() method. Check out the article below:
http://weblogs.asp.net/scottgu/archive/2006/01/29/436854.aspx
0 comments:
Post a Comment