DataBind issue

From: Tomislav Bartolin (tomislav.bartolinTB_at_zg.htnet.hr)
Date: 12/08/04


Date: Wed, 8 Dec 2004 08:50:03 +0100

Hi,

I have an aspx page which contains an ascx user control.
I am using Page.DataBind in Page_Load event of the page to bind elements to
page properties.
The problem is the ascx uses its Page_Load event to create objects which are
then used
for data binding, but because I call Page.DataBind in the parent page, the
ascx Page_Load event doesn't complete and its objects are null
references, so I get errors.
I have found a workaround for this issue, by using Page_PreRender event do
call Page.DataBind so that the ascx Page_Load event can complete.
I am wondering if this solution is ok,
and is there a way to prevent data binding of some page child controls when
Page.DataBind is called?

Thanks,

-- 
Bartol
--
Remove "TB" from address to reply