Accessing control in GridTemplateColumn

2 posts, 0 answers
  1. J
    J avatar
    143 posts
    Member since:
    Jun 2006

    Posted 04 Mar 2010 Link to this post

    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
  2. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 04 Mar 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top