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

DropdownList - InPlace Edit - SelectedIndexChanged Event

2 Answers 250 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 2
Charles asked on 09 Apr 2010, 02:24 PM
I have been able to dynamically load some dropdown lists to be used during an inplace edit in the RadGrid. I do this within the ItemCreated event of the grid. 

I also attach a SelectedIndexChange event to one of the dropdowns (call it dropdown "A"). I need to change the selected index of a different dropdown within the same row (call it dropdown "B") when the user changes the selected index in dropdown A.

The event fires and I can retrieve a new selected value in A, but now I'm at a loss as to how to retrieve the approiate dropdown B to alter it's selected index based on the value chosen in A. I don't have visiblity to a grid "item" from the SelectedIndexChanged event and the databound event doesn't seem to fire when dropdown A's event fires - so I can't get access to the grid item to do a FindControl on dropdown B. I have the AutoPostBack property of dropdown A set to "true".

Any suggestinons? 

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 12 Apr 2010, 08:58 AM
Hello Charles,

You can set the SelectedIndex of a dropdownB when the user changes the selection in dropdownA, by using following code snippet.

CS:
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) 
    { 
        DropDownList dropdownA = (DropDownList)sender; 
        GridEditableItem editForm = (GridEditableItem)dropdownA.NamingContainer; 
        DropDownList dropdownB = (DropDownList)editForm.FindControl("DropDownList2"); 
        // Set the dropdownB selected value based on dropdownA selection
}


Regards,
Shinu.
0
Charles
Top achievements
Rank 2
answered on 12 Apr 2010, 08:28 PM
Thanks. That looks like it will work for me.
Tags
Grid
Asked by
Charles
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Charles
Top achievements
Rank 2
Share this question
or