<pre lang="c#">
Parent Grid row bound Event:
protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string DepartmentID = gvDepartment.DataKeys[e.Row.RowIndex].Value.ToString();
GridView gvCompleated = e.Row.FindControl("gvCompleated") as GridView;
GridView gvRunning = e.Row.FindControl("gvRunning") as GridView;
TaskGateway employeeGateObj = new TaskGateway();
gvRunning.DataSource = employeeGateObj.GetTaskTable(DepartmentID);
gvRunning.DataBind();
gvCompleated.DataSource = employeeGateObj.GetPendingTaskTable(DepartmentID);
gvCompleated.DataBind();
foreach (GridViewRow gr in gvCompleated.Rows)
{
if (gr.RowType == DataControlRowType.DataRow)
{
LinkButton lnkbtnresult = (LinkButton)gr.Cells[0].FindControl("requestID3");
if (lnkbtnresult != null)
{
lnkbtnresult.Click += new System.EventHandler(requestID3_Click);
}
}
}
foreach (GridViewRow gr in gvRunning.Rows)
{
if (gr.RowType == DataControlRowType.DataRow)
{
LinkButton lnkbtnresult = (LinkButton)gr.Cells[0].FindControl("requestID3");
if (lnkbtnresult != null)
{
lnkbtnresult.Click += new System.EventHandler(requestID3_Click);
}
}
}
}
The above code i did on the parent grid row bound, in the parent grid i have two child grid view one is gvcompleted and another is gvrunning,and i have link button on each child grid view but i am not able to handle click event of link button, even i tried to do on the child grid rowbound and rowcommand event but they are not working.