I have one parent gridview in which linkbutton is there..onclick of linkbutton of that particular row the child grid for the row should be binded with value..
here is the code
Aspx:-
Edit
C# code:-
protected void grdOrderDetails_RowDataBound(object sender, GridViewRowEventArgs e)
{
SqlConnection conn = ApplicationInfo.GetConnection();
if (e.Row.RowIndex != -1)
{
string bintOrderId = ((Label)e.Row.FindControl("lblOrderId")).Text.Trim();
HtmlAnchor Anchor = (HtmlAnchor)e.Row.FindControl("btnEdit");
Anchor.Attributes.Add("onclick", "GB_show('Order Details','/CMSAdmin/frmSalesOrder.aspx?OId=" + bintOrderId + "&OP=0',600,600,'')");
}
if (e.Row.RowType == DataControlRowType.DataRow)
{
string OrderId = grdOrderDetails.DataKeys[e.Row.RowIndex].Value.ToString();
GridView grdDispatch = e.Row.FindControl("grdDispatch") as GridView;
DataSet ds = DashBoardManger.Bind_Data_ByOrderId(conn, Convert.ToInt64(OrderId));
grdDispatch.DataSource = ds;
grdDispatch.DataBind();
}
}
{
SqlConnection conn = ApplicationInfo.GetConnection();
if (e.Row.RowIndex != -1)
{
string bintOrderId = ((Label)e.Row.FindControl("lblOrderId")).Text.Trim();
HtmlAnchor Anchor = (HtmlAnchor)e.Row.FindControl("btnEdit");
Anchor.Attributes.Add("onclick", "GB_show('Order Details','/CMSAdmin/frmSalesOrder.aspx?OId=" + bintOrderId + "&OP=0',600,600,'')");
}
if (e.Row.RowType == DataControlRowType.DataRow)
{
string OrderId = grdOrderDetails.DataKeys[e.Row.RowIndex].Value.ToString();
GridView grdDispatch = e.Row.FindControl("grdDispatch") as GridView;
DataSet ds = DashBoardManger.Bind_Data_ByOrderId(conn, Convert.ToInt64(OrderId));
grdDispatch.DataSource = ds;
grdDispatch.DataBind();
}
}
Replies
Know the answer? Post it — somebody with the same question will find it here.