first debug that is selected index value is -1 if yes then your grid always load on every post back so please use
!page.isPostback and bind the gird in this condition if you'll face problem then please send me your code i'll solve this only for you
my email is ssohail@sunbonn.com please mention the refernce with www.asp.net or if you dont want to send your code then please post here your front hand html and code behind both
kalyanns
Member
243 Points
274 Posts
Finding a GridView
Dec 08, 2012 06:43 AM|LINK
Hi Guys,
I got stuck with finding controls in the Nested Gridview
Here i got a Gridview1 and i want to find the Gridview2. which is in the Gridview1
its nothing but Nested GridView.
How can i find the Gridview Control in Button Click
GridView gvAll = (GridView)Gridview1.FindControl("Gridview2");i checked with break it says ' Null '
Kindly please Help me
Do FEAR (Face Everything And Rise)
SohailShaikh
Contributor
6119 Points
1167 Posts
Re: Finding a GridView
Dec 08, 2012 06:53 AM|LINK
GridView gvR = (GridView)gvRP.Rows[0].FindControl("Gridview2"); gvR.DataSource = DataSet; gvR.DataBind();Sohail Shaikh
dotnetbyrahu...
Member
19 Points
85 Posts
Re: Finding a GridView
Dec 08, 2012 07:26 AM|LINK
Write On This Way.. GridView gvR = (GridView)gvRP.Rows[0].FindControl("Gridview2"); gvR.DataSource = DataSet; gvR.DataBind();kalyanns
Member
243 Points
274 Posts
Re: Finding a GridView
Dec 08, 2012 08:31 AM|LINK
Rows[0]. one the Zero row its returning how can i if i select 1st row but programatically it should come.
Do FEAR (Face Everything And Rise)
kalyanns
Member
243 Points
274 Posts
Re: Finding a GridView
Dec 08, 2012 08:32 AM|LINK
i am getting an error at this place.
GridView gvAll = (GridView)grdgrpkra.Rows[grdgrpkra.SelectedIndex].FindControl("grdgrpkra2");Index was out of range. Must be non-negative and less than the size of the collection.
Do FEAR (Face Everything And Rise)
hafizzeeshan
Participant
834 Points
253 Posts
Re: Finding a GridView
Dec 08, 2012 08:36 AM|LINK
hi
Please check the Following
private void LoadInnerGrid(int ParentGridRowNumber) { GridView gv = (GridView)gvRP.Rows[ParentGridRowNumber].FindControl("Gridview2"); gv.DataSource = DataTable; gv.DataBind(); }Zeeshan Rauf
# 92-3216698206
Email : zeeshan_rouf@hotmail.com
Please mark the replies as answers if they help or unmark if not.
SohailShaikh
Contributor
6119 Points
1167 Posts
Re: Finding a GridView
Dec 09, 2012 03:52 AM|LINK
first debug that is selected index value is -1 if yes then your grid always load on every post back so please use
!page.isPostback and bind the gird in this condition if you'll face problem then please send me your code i'll solve this only for you
my email is ssohail@sunbonn.com please mention the refernce with www.asp.net or if you dont want to send your code then please post here your front hand html and code behind both
Sohail Shaikh
SohailShaikh
Contributor
6119 Points
1167 Posts
Re: Finding a GridView
Dec 09, 2012 05:31 AM|LINK
He Check this link its quite use full for you
http://www.aspdotnet-suresh.com/2012/05/gridview-with-in-gridview-or-nested.html
Sohail Shaikh