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

programmatically added dropdownlist

1 Answer 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Giovanni
Top achievements
Rank 1
Giovanni asked on 19 Jan 2012, 11:01 AM
Hallo,

     I'm creating a grid at runtime, dynamically adding the columns; I'm also using InPlace edit mode. The grid is working in normal columns (for example, I set the GridNumericColumnEditor for my GridNumericColumn, and I can get the cell value using the GridEditManager GetColumnEditor method).

    Now I have a column which has templates for Item and EditItem. In the EditItemTemplate (which inherits IBindableTemplate) I put a DropDownList. I could set the right value to show in the dropdownlist when in edit mode, but I don't know how to get the cell value. I've tried with the GridEditManager, as for my normal columns, but the GridTemplateColumnEditor has no controls...

    Can you help me?

   Thank you

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 20 Jan 2012, 03:22 PM
Giovanni:

Please reference the Operations with MS DropDownList in EditItemTemplate of GridTemplateColumn documentation page. It provides insights on getting/setting values using the .FindControl() method.

As an example:
private void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
    GridEditableItem editedItem = e.Item as GridEditableItem;
    DropDownList list = editedItem.FindControl("List1") as DropDownList;
    Session["updatedValue"] = list.SelectedValue;
}

Hope this helps!
Tags
Grid
Asked by
Giovanni
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or