ItemDataBound not being caught

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everyone,

We're using ASP.net 1.1 and when we load a control dynamically, using
LoadControl, the ItemDataBound of the DataGrid that sits in this dynamically
loaded control does not get hit. Does anyone know why at all?

Any help would be great. Thanks,

Jon
 
Hi Jon,

Where are you setting the event handler for ItemDataBound?

Can you please give me the code that you use for loading the datagrid?

I think that we have to basically do something like this:

DataGrid usersGrid = (DataGrid)LoadControl("something.ascx");
usersGrid.ItemDataBound += this.somemethod;
usersGrid.DataSource = ----------
usersGrid.DataBind();

Regards,
Jim
 
Hi Jim.

The ItemDataBound event is within the UserControl, and the LoadControl is
called in a ItemRender event of a separte grid.

Thanks,

Jon
 
Hi Jon,

How about providing the code? Just the relevant code will do.

'The ItemDataBound event is within the UserControl': This means the
datagrid is in the user control, right.

'and the LoadControl is called in a ItemRender event of a separte
grid.':- Did you mean the DataGridItem.PreRender event? I am curious
about the requirement, and would you mind letting me know why you have
to call LoadControl in the prerender event for each item in the
datagrid?

Regards,

Jim
 
Back
Top