This is a migrated thread and some comments may be shown as answers.

[Solved] How to find a control the resides in RadGrid

1 Answer 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kem Arda
Top achievements
Rank 1
Kem Arda asked on 10 Aug 2009, 02:57 PM
I just need to find a dropdown that resides in ItemTemplate of MasterTableView: Colums 3 of RadGrid. I just tried following:

DropDownList

temp = ((DropDownList)RadGridMkbzHzmt.MasterTableView.FindControl("ddlHzmt"));

It throws exception "Object reference not set to an instance of an object"

How can i get over this?

Thanks in advance...

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 10 Aug 2009, 03:50 PM
Hello Kem,

Try the following approach to find the control in the first row:
DropDownList temp = ((DropDownList)RadGridMkbzHzmt.MasterTableView.Items[0].FindControl("ddlHzmt")); 
 

or iterate through all grid rows:
foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
    DropDownList ddl = item.FindControl("ddlHzmt"as DropDownList; 
    if (ddl != null
    {  
        //do something 
    } 

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Kem Arda
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or