how to fire event o f link button that nested in gridview and gridview is nested in datalist.
On ItemCreated event, Find Gridview and create RowCreated event of gridview, now on rowCreated event
of gridview, find LinkButton and create click event from there.
Look belove example.
public void dList_ItemCreated(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
//Find gridview from DataList Item and Create RowCreated Event
GridView gridView = (GridView)e.Item.FindControl("GridViewID");
gridView.RowCreated += new GridViewRowEventHandler(gridView_RowCreated);
}
}
public void gridView_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//Find Link Button and create event handler
LinkButton lnkButton = new LinkButton();
lnkButton.Click += new EventHandler(lnkButton_Click);
}
}
public void lnkButton_Click(object sender, EventArgs e)
{
//Write your code here
}
Regard
Imrankhan
Imrankhan
-----------------------------------------------------
Always remember to mark as answer on the post that helped you.
My Blog :
http://aspnet-solutions.blogspot.com/
http://javascriptsolution.blogspot.com/
Member
3 Points
30 Posts
nested nested link button event
Nov 06, 2009 06:26 AM|rajeev.sharma.amb|LINK
how to fire event o f link button that nested in gridview and gridview is nested in datalist.
Contributor
2039 Points
637 Posts
Re: nested nested link button event
Nov 06, 2009 08:04 AM|imran_khan|LINK
On ItemCreated event, Find Gridview and create RowCreated event of gridview, now on rowCreated event
of gridview, find LinkButton and create click event from there.
Look belove example.
Regard
Imrankhan
-----------------------------------------------------
Always remember to mark as answer on the post that helped you.
My Blog :
http://aspnet-solutions.blogspot.com/
http://javascriptsolution.blogspot.com/