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

Related / Casacading Dropdownlists in a Grid

1 Answer 22 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Donna
Top achievements
Rank 1
Donna asked on 21 Oct 2009, 09:40 PM
Does anyone know how to create related / casacading dropdownlists in a telerik grid? Can this be done?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Oct 2009, 05:15 AM
Hello Donna,

You can get reference to the controls in grid and populate it depending on an option the user selects for another control in the grid itself. Try out the following example which shows how to populate a combobox based on the selection in another combobox in the grid:
aspx:
<telerik:GridTemplateColumn UniqueName="ContactTitle" HeaderText="ContactTitle">         
     <ItemTemplate>  
         <telerik:RadComboBox ID="RadComboBox1" AutoPostBack="true" runat="server" SelectedValue='<%# Bind("ContactTitle") %>' DataSourceID="SqlDataSource1" DataTextField="ContactTitle"  OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">             
         </telerik:RadComboBox>           
     </ItemTemplate>  
</telerik:GridTemplateColumn>  
  
<telerik:GridTemplateColumn UniqueName="TemplateColumn">  
     <ItemTemplate>  
         <telerik:RadComboBox ID="RadComboBox2"  runat="server">  
         </telerik:RadComboBox>  
     </ItemTemplate>  
</telerik:GridTemplateColumn>  

c#:
 protected void RadComboBox1_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)  
    {  
        RadComboBox rdcbx = (RadComboBox)o;  
        GridEditableItem item = rdcbx.NamingContainer as GridDataItem;  
        RadComboBox ddList = eitem.FindControl("RadComboBox2") as RadComboBox;  
        // change the data source for ddList here  
         .....         
    }  

Thanks
Princy.
Tags
Grid
Asked by
Donna
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or