ItemDataBound not being caught

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
 
J

jim4u

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
 
G

Guest

Hi Jim.

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

Thanks,

Jon
 
J

jim4u

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,278
Latest member
BuzzDefenderpro

Latest Threads

Top