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

telerik:GridDropDown SelectindexChanged event

1 Answer 35 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Rahul Barpha
Top achievements
Rank 1
Rahul Barpha asked on 05 May 2010, 10:34 AM
Hello,

I Have a problen related to "telerik:GridDropDownColumn" ,
i have two GridDropDownlist in telerik radgrid when i going edit mode
 i want to call first GridDropDown selectindexchange event and get selected value and pass to second GridDropDown

SqlDataSource as a difault value.
Plz anyone Help me...

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 May 2010, 11:07 AM
Hi Rahul Barpha,

Access the DropDownList control rendered in EditForm and attach the 'SelectedIndexChanged' event from code behind in ItemCreated event. Then in the SelectedIndexChanged event, you can easily access second DropDownList and set the value. Here is the code example.

ASPX:
 
    <telerik:GridDropDownColumn UniqueName="DropDownColumn1" ListTextField="CustomerID" 
        ListValueField="CustomerID" DataSourceID="SqlDataSource1" HeaderText="Dropdown" 
        DropDownControlType="DropDownList"
    </telerik:GridDropDownColumn> 
    <telerik:GridDropDownColumn UniqueName="DropDownColumn2" ListTextField="CustomerID" 
        ListValueField="CustomerID" DataSourceID="SqlDataSource1" HeaderText="Dropdown" 
        DropDownControlType="DropDownList"
    </telerik:GridDropDownColumn> 


C#:
 
    private void list_SelectedIndexChanged(object sender, System.EventArgs e)  
    {  
        DropDownList dropDown = (DropDownList)sender;  
        GridEditFormItem editForm = (GridEditFormItem)dropDown.NamingContainer;  
        DropDownList dropDown2 = (DropDownList)editForm["DropDownColumn2"].Controls[0];  
        dropDown2.SelectedValue = dropDown.SelectedValue;  
    } 
    private void list_SelectedIndexChanged(object sender, System.EventArgs e) 
    { 
        DropDownList dropDown = (DropDownList)sender; 
        GridEditFormItem editForm = (GridEditFormItem)dropDown.NamingContainer; 
        DropDownList dropDown2 = (DropDownList)editForm["DropDownColumn2"].Controls[0]; 
        dropDown2.SelectedValue = dropDown.SelectedValue; 
    } 


Regards,
Princy.
Tags
Calendar
Asked by
Rahul Barpha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or