Access webcontrol gridview using page.Fincontrol????

Posted by Oswaldlily under ASP.NET on 7/17/2013 | Points: 10 | Views : 1255 | Status : [Member] | Replies : 2
My gridivew is null inside static method..


so i m trying to access my web control gridivew using:
Page page = HttpContext.Current.Handler as Page;
GridView gv = (GridView)page.FindControl("gv");

still gridview is null




Responses

Posted by: Bandi on: 7/30/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
This link might help you... ( I think you have to use FindControlRecursive()
http://stackoverflow.com/questions/6525804/using-findcontrol-to-get-gridview-in-a-content-page
http://stackoverflow.com/questions/13336839/asp-net-findcontrol-and-gridview-returning-null?rq=1

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

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

Posted by: aswinialuri-19361 on: 7/30/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,
refer this links it might be help to you

http://www.codeproject.com/Tips/424661/Access-Controls-from-ASP-NET-GridView-EmptyDataTem
http://stackoverflow.com/questions/6525804/using-findcontrol-to-get-gridview-in-a-content-page

Mark as Answer if it helps you
Thanks&Regards
Aswini Aluri

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

Login to post response