In my Application, I have created on GridView At Design Time. On RowDataBound Event I add One more Row to the grid. In that Row I added on Div and Inside that div I have created a Gridview dynamically. On Click of one of the Cell of Static grid I set Display Property Of Div to None or Blank to make Dynamic created grid InVisible/Visible respectively.
This functionality working fine with me. Now when I want to go to another Page on the click of one of cell of Dynamically created Grid with the all data contain in that clicked Cells Row. For Dynamic Grid I have Added few events such as "RowDataBound", "SelectedIndexChanging" etc. Out of All written Events only RowDataBound event is firing other events not firing in my case.
Again to check further, I add LinkButton to one cell and add click event to that button in RowDataBound Event of Dynamic Grid. Still Link Button Click event not firing.
So I wonder why this is happening. Any Clue regarding This issue.
Is there any Link with Event Firing and Page's Postback or DataBind
Thanks,
VIkram
Amit ChoudharyPosted May 3, 2010, 3:33 AM
i have tried this code by creating a dummy page... its working great..
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lbtn = new LinkButton();
lbtn.Text = e.Row.Cells[0].Text;
lbtn.Click += new EventHandler(lbtn_Click);
e.Row.Cells[0].Controls.Add(lbtn);
}
}
... check for if you have some validations control added on your page because some times it prevent the controls from firing the events.
Let me know if it helps you.
VikramPosted May 3, 2010, 2:43 AM
Thanks for reply. Actually I have added same code which you mentioned in previous code. But that event not firing.
I have added following Code in my RowDataBound Event of Dynamic GridView.
Still The Click Event not Firing.
Thanks,
VIkram
Amit ChoudharyPosted May 3, 2010, 2:25 AM
i have gave you solution for this problem in your previous thread... check there...