reference to grid located in combobox template located in grid

2 posts, 0 answers
  1. Łukasz Kuryło
    Łukasz Kuryło avatar
    24 posts
    Member since:
    Jan 2010

    Posted 27 Apr 2010 Link to this post

    Hi all.
    I have a code
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1"  
                GridLines="None" onitemdatabound="RadGrid1_ItemDataBound"
                <MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
                    <Columns> 
                        <telerik:GridTemplateColumn> 
                            <FooterTemplate> 
                                <telerik:RadComboBox ID="RadComboBox1" runat="server"
                                    <ItemTemplate> 
                                        <telerik:RadGrid ID="RadGrid2" runat="server"
                                        </telerik:RadGrid> 
                                    </ItemTemplate> 
                                </telerik:RadComboBox> 
                            </FooterTemplate> 
                        </telerik:GridTemplateColumn> 
                    </Columns> 
                </MasterTableView> 
            </telerik:RadGrid> 
            <asp:SqlDataSource ID="SqlDataSource1" runat="server"  
                ConnectionString="<%$ ConnectionStrings:XConnectionString %>"  
                SelectCommand="SELECT [Name] FROM [Projects]"></asp:SqlDataSource> 
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridFooterItem) 
            { 
                GridFooterItem footer = (GridFooterItem)e.Item; 
                RadComboBox combo = ((RadComboBox)footer.FindControl("RadComboBox1")); 
                RadGrid grid = ((RadGrid)combo.Items[0].FindControl("RadGrid2")); //result is null
                //RadGrid grid = ((RadGrid)combo.FindControl("RadGrid2")); //result is null

                string r = "fF"
            } 
        } 

    The question is how can I get reference to RadGrid2?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Apr 2010 Link to this post

    Hello Lukasz,

    Your code works fine in my end when adding a RadComboBoxItem for RadComboBox. Give a try by adding RadComboBoxItem and see whether it helps you.

    ASPX:
    <telerik:GridTemplateColumn> 
      <FooterTemplate> 
         <telerik:RadComboBox ID="RadComboBox1" runat="server"
             <ItemTemplate> 
                    <telerik:RadGrid ID="RadGrid2" runat="server"
                     </telerik:RadGrid> 
             </ItemTemplate> 
             <Items> 
               <telerik:RadComboBoxItem /> 
             </Items> 
          </telerik:RadComboBox> 
      </FooterTemplate> 
    </telerik:GridTemplateColumn> 

    Feel free to share the comments,
    Shinu.



  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top