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

Rad Grid Drop Downs Selected Index Changed and GridDropDownListColumnEditor

1 Answer 217 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
The KID asked on 04 Dec 2008, 11:50 PM
Ok, telerik riddle me this,

I've built a grid where when in insertiing/updating mode I have two cascading drop downs, the first of which I'm adding the selected index change event when the item is being created. I got everything working splendidly, even the Ajax was working on it and it was beautiful. Then I added GridDropDownListColumnEditors to the grid columns so when in edit mode they'd look all pretty but by doing so that stopped the cascading when in inserting/editing mode. Now why in the world would that have an effect on the behavoir of the control because it shouldn't. Isn't that like one of the first rules about programming, style changes should not have any effect on functionality?

My assumtion is that if you use the GridDropDownListColumnEditors, then in my selected index change event i need to have my column editors also rebind along with the drop down columns?? Or do i need to declare in my rad ajax manager that the editor columns can update the other or vice versa? Currently the only thing the rad ajax manager has declared is that the grid can control itself.

The following code is the selected change event that makes the cascading work.

    protected void Category_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) 
        //First reference the edited grid item through the NamingContainer attribute 
        GridEditableItem editedItem = (sender as RadComboBox).NamingContainer as GridEditableItem; 
        //The dropdown list will be the first control in the Controls collection of the corresponding cell 
        RadComboBox ddlist = editedItem["ParentCategory"].Controls[0] as RadComboBox; 
        //Change the data source of the sub-categories dropdown list 
        sdsSubCategories.SelectParameters.Add("ParentCategoryId", ddlist.SelectedValue); 
        //Change the combox's datasource to the sub categories datasource 
        RadComboBox ddlistSub = editedItem["SubCategory"].Controls[0] as RadComboBox; 
        ddlistSub.DataSource = Schools.SubCategoryList(Convert.ToInt32(ddlist.SelectedValue)); 

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 08 Dec 2008, 02:31 PM
Hi Mike,

This is indeed a strange issue and unfortunately I cannot say for certain what might be the exact reason for the abnormality. Can you please verify that you set merely style settings through the declarative GridDropDownListColumnEditors? I tested the local version of this online demo by adding declarative style editors for the dropdown list columns as follows:

        <telerik:RadGrid Width="97%" ID="RadGrid1" runat="server" Skin="Office2007"   
            OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCreated="RadGrid1_ItemCreated" OnItemDataBound="RadGrid1_ItemDataBound">  
            <PagerStyle Mode="NextPrevAndNumeric" /> 
            <MasterTableView AutoGenerateColumns="false" Width="100%">  
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Highlight <br/> ship name">  
                            <asp:Panel ID="Panel1" runat="server">  
                                <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckedChanged" /> 
                    <telerik:GridDropDownColumn UniqueName="ddlOrderID" ListTextField="OrderID" ListValueField="OrderID" 
                        ListDataMember="Orders" DataField="OrderID" HeaderText="Order ID" DropDownControlType="RadComboBox" ColumnEditorID="DropDownListColumnEditor1" /> 
                    <telerik:GridBoundColumn UniqueName="ShipName" DataField="ShipName" HeaderText="Ship name" /> 
                    <telerik:GridBoundColumn UniqueName="ShipAddress" DataField="ShipAddress" HeaderText="Ship address" /> 
                    <telerik:GridDropDownColumn UniqueName="ddlQuantity" ListTextField="Quantity" ListValueField="OrderID" 
                        ListDataMember="OrderDetails" DataField="OrderID" HeaderText="Quantities in stock" DropDownControlType="RadComboBox" ColumnEditorID="DropDownListColumnEditor1" /> 
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton" /> 
                    <EditColumn ButtonType="ImageButton"/>  
        <telerik:GridDropDownListColumnEditor ID="DropDownListColumnEditor1" runat="server">  
         <DropDownStyle Font-Bold="true" /> 
and the dependency between the combo editors remained intact. I will appreciate if you outline the differences between my case and yours - they can lead us to the source of the issue to address it asap.

Kind regards,
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Top achievements
Rank 2
Answers by
Telerik team
Share this question