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

Dropdown in RadGrid

3 Answers 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
VS
Top achievements
Rank 1
VS asked on 02 Sep 2008, 11:41 AM
Hi,

I have a radgrid with gridbound columns and one dropdown column. When in edit mode, if i change the selected item from the dropdown, how can i display its text into another  field in the edit mode.

Which event should i use and how to make that event fire..and also how to display that selected text and selected value onto a different field in edit mode.

Regards

Sujith

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 02 Sep 2008, 12:08 PM
Hello Sujith,

There is a couple of ways you can achieve this functionality. The easiest approach is to use a GridTemplateColumn with a dropdownlist in the EditItemTemplate. Thus, you can configure your dropdownlist to autopostback and fire the OnSelectedIndexChanged event. In the event handler, you can find the textbox or input field you need to populate and set its values.

Another approach is to do the same thing on the client where you would attach a javascript method to your OnSelectedIndexChanged event.

A third approach is to stick to the auto-generated GridDropDownColumn, but get a reference to the actual dropdownlist (or RadComboBox) control in the ItemDataBound event. Once you reference it, you can now attach a javascript function to its "onclick" property, so that each time a new value is clicked from the list, the target input element gets updated.

Please see which one of these approaches works for you and write back if you get stuck in the implementation.

All the best,
Veli
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
VS
Top achievements
Rank 1
answered on 02 Sep 2008, 12:13 PM
Hi veli,

Thanks for the repl.y.
How will i assign the value to a different field from the javascipt. Do u have an example of it?


Regards

Sujith
0
Shinu
Top achievements
Rank 2
answered on 02 Sep 2008, 12:14 PM
Hi Sujith,

Try accessing the DropDownList for the DropDownColumn in the ItemCreated event and add the SelectedIndexChanged event handler for it. And in the SelectedIndexChanged event of the DropDownList try accessing the TextBox in the edit form. Set the text of the TextBox to the selected text of the DropDownList.
 You can also refer the following demo link which shows a similar functionality in edit mode.
Accessing cells and rows

Thanks
Shinu.
Tags
Grid
Asked by
VS
Top achievements
Rank 1
Answers by
Veli
Telerik team
VS
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or