Link to home
Start Free TrialLog in
Avatar of AlanPalan
AlanPalan

asked on

asp:Datagrid in asp:table not triggerring ItemCommand() and PageIndexChanged() event?

When I add an asp.net datagrid on a web form, the dg_ItemCommand() and dg_PAgeIndexChanged() events trigger ok when I click on the grid. When I add the datagrid to an asp.net table cell (using tablename.Rows(0).Cells(0).Controls.Add(dg), the datagrid displays ok, but the events are no longer triggerred.

I guess this is something to do with the events beings nested within the 'parent' table control. Is there any simple way to access the events again. I am programming in vb.net.

SOLUTION
Avatar of ihenry
ihenry

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AlanPalan
AlanPalan

ASKER

I'm a bit confused. Thanks for your comments.

I've managed to solve this one by adding the datagrid to the asp:table at design time using the visual studio html editor. I make the datagrid invisible until I need it. The datagrid events then fire ok.

I think the problem arose somehow from adding the datagrid using table.rows(0).cells(0).controls.add(dg) at run time.

Not sure if this was what you were getting at hamood thanks for your thoughts anyway?

also jhenry, sounds like you might have been on to it?

hamood, altough I solved it by adding controls in html designer rather than programatically, I think your solution would also be ok for future
jhenry sounds like you were on it too.
will do a points split