views:

47

answers:

2

Hi,

I am having a DataGrid in one usercontrol which is getting filled with some data when I press some button(ouside it). This Datagrid is filled by one linkbutton also. When I click this LinkButton then OnItemCommand or SelectedIndexChanged should fire, but both the events are not firng. While the control's PageLoad event is firing.

Please let me know where I am doing the mistake.

Thanks

A: 

Is your control added dynamically, using something like Page.LoadControl()? If so, events won't fire unless the control is dynamically added for each request. That's the only way the control tree can be properly built again. I usually do this in Init().

Corey Coogan
A: 

http://www.4guysfromrolla.com/articles/042402-1.aspx

For those that see this post, looking for an answer. Most likely, you're rebinding the data to the datagrid on every call. Use a conditional and check !this.IsPostBack.

MightyZot