AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 find control returns null value??
Posted by Ankur Dagar on  12/18/2009 1:23:37 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend
Hiii,

I am using a dropdown list in an gridview under edit item template,
I want to acess that for that i use

if(e.Row .RowType ==DataControlRowType .DataRow )
{
DropDownList ddlsd;
ddlsd =e.Row .FindControl ("ddl1") as DropDownList ;
if(ddlsd !=null)
{
classs(ddlsd);

}

but it returns null values and it generates error ,

Any body hav a solutions plzz post ur reply as soon as possible.

One thing more I am not using update item


thanks





Post Your Reply Post New Question

 Viewer's Reply
Finding DropdownList in GridView1_RowDataBound Event
Answered By Moderator1 on 12/18/2009 9:44:33 PM
Hi,

For C#, you can try like this,

DropDownList ddlsd = (DropDownList)e.Row.FindControl("ddlsd");

Make sure the ID is same as you passed in FindControl method.
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
Programmers Heaven C# School Book - Free 338 Page eBook
Web Application Security — How to Minimize Prevalent Risk of Attacks
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview