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

Accessing control in GridTemplateColumn

1 Answer 220 Views
Grid
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 04 Mar 2010, 02:24 PM
I have a GridTemplateColumn inside a RadGrid but not sure how to access the controls.

<telerik:GridTemplateColumn UniqueName="TemplateColumn1">  
    <ItemTemplate> 
        <div> 
            <table> 
                <tr> 
                    <td colspan="2">  
                        <telerik:RadComboBox ID="rdDDB" runat="server" 
                         onload="rdDDB_Load">  
                        </telerik:RadComboBox>                                                  
                    </td> 
                </tr> 
                <tr> 
                    <td>Action 1</td> 
                    <td>Action 2</td> 
                </tr> 
            </table> 
        </div> 
    </ItemTemplate> 
</telerik:GridTemplateColumn> 

I know that to probably access that particular row I should look it during the RadGrid ItemDataBound event
protected void PManagerReqStmtGrid_ItemDataBound(object sender, GridItemEventArgs e)  
{  
    RadComboBox rd = RadGrid.MasterTableView.Columns.FindByUniqueName("TemplateColumn1");  

Any suggestions?

J

1 Answer, 1 is accepted

Sort by
0
robertw102
Top achievements
Rank 1
answered on 04 Mar 2010, 03:21 PM
You should change it to this:

protected void PManagerReqStmtGrid_ItemDataBound(object sender, GridItemEventArgs e)   
{   
    RadComboBox rd = (RadComboBox)RadGrid.MasterTableView.Columns.FindByUniqueName("TemplateColumn1").FindControl("rdDDB");   

You have to get the column and then you search it's controls collection for the control you want.

I hope that helps.
Tags
Grid
Asked by
J
Top achievements
Rank 1
Answers by
robertw102
Top achievements
Rank 1
Share this question
or