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

reference to grid located in combobox template located in grid

1 Answer 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Łukasz Kuryło
Top achievements
Rank 1
Łukasz Kuryło asked on 27 Apr 2010, 08:30 PM
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?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Apr 2010, 06:53 AM
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.



Tags
Grid
Asked by
Łukasz Kuryło
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or