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

add drop down in grid

1 Answer 20 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gina
Top achievements
Rank 1
Gina asked on 31 Aug 2009, 08:28 PM
I created a grid to do an edit, I am trying to add a dropdown in my grid for the KMA name however when you go into the edit mode it gives you a different KMA name then the one originally selected to edit.. can someone explain to me how to bind that drop down to show the Kma that was selected, as it's very confusing  because what you selected is not what comes up ?

 

<telerik:GridDropDownColumn DataSourceID="sqlKMAgrid" ListTextField="KMA_LongDesc" ListValueField="ID"

 

 

SortExpression="KMA_LongDesc" HeaderText="KMA" DropDownControlType="DropDownList"

 

 

DataField="KMA_LongDesc" >

 

 

</telerik:GridDropDownColumn>

 

 

<telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="KMA_LongDesc"

 

 

FilterListOptions="VaryByDataType" ForceExtractValue="None" HeaderText="KMA_LongDesc"

 

 

SortExpression="KMA_LongDesc" UniqueName="KMA_LongDesc">

 

 

</telerik:GridBoundColumn>

thank you for any help you can give

 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 01 Sep 2009, 07:38 AM
Hello Gina,

For the GridDropDownColumn, you need to assign SelectedValue or SelectedIndex to the editor right after you bind it to data. You can refer the section "Customizing the options for GridDropDownColumn on editing" of the following document:
Customize/Configure GridDropDownColumn

To determine what to select, use DataBinder.Eval(e.Item.DataItem, "DataField").ToString() inside the ItemDataBound handler.

Thanks
Shinu.
Tags
Grid
Asked by
Gina
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or