Monday 21 January 2013

Fire Events in Dynamically Created Gridview


Fire Events in Dynamically Created Gridview


Most of us have used Dynamic Gridviews in our project.. If you are not familiar with dynamic gridview; then please refer these links first:


But the problem arises when we are asked to handle the events inside the dynamic Gridview..

In this case what to do???

So Here I am with the solution and relevant links:

For Binding Events we could do like this:

 GridView gv = new GridView();
 gv.RowDataBound += new GridViewRowEventHandler(gv_RowDataBound);

 Then We could handle the events like this: 
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
  // your code
}

 For More Details refer these links:


http://forums.asp.net/t/1276555.aspx/1?Dynamic+Gridview+Event+Handler+not+fire+RowCommand+RowDeleting+SelectedindexChanging+

http://stackoverflow.com/questions/4757058/how-to-create-gridview-updating-event-dynamically

http://stackoverflow.com/questions/2021580/selectedindexchanged-on-dynamically-created-gridview
  

No comments:

Post a Comment

Thank You for Your Comments. We will get back to you soon.

back to top