find gridview inside gridview

Posted by Venkatesh under ASP.NET on 4/27/2011 | Points: 10 | Views : 3904 | Status : [Member] | Replies : 3
HI

How to assign datasource to gridview that is inside another gridview

Thanks
Venkatesh.P




Responses

Posted by: Ndebata on: 4/27/2011 [Member] Starter | Points: 25

Up
0
Down
if you are attaching / showing the child gridview in parent gridview data.
You can set the datasource of chid gridview on the rowdatabound event of parent gridview.

Venkatesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhakar on: 4/27/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi venktesh , .


set child Gridview data source on parent Gridview Rowdatabound Event . .

Check this Example. .

http://www.codeproject.com/KB/webforms/GridViewInsideGridView.aspx

Best Regard's
Prabhakar

Venkatesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Tijut2k on: 4/27/2011 [Member] Starter | Points: 25

Up
0
Down
protected void grdFirst_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
GridView grdSec= (GridView )e.Row.FindControl("grdSec");

grdSec.DataSource = GetDeptDetails(Convert.ToInt32(subCdPk));

grdSec.DataBind();
}
}



Best Regard's
Tiju Thankachan

Venkatesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response