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

[Solved] dropdown within template column of grid

3 Answers 170 Views
Grid
This is a migrated thread and some comments may be shown as answers.
newbie
Top achievements
Rank 1
newbie asked on 22 Apr 2008, 04:49 PM
I have a dropdown column within the template column 

<

telerik:GridTemplateColumn HeaderText="Device Type" SortExpression="DeviceDisplayValue" UniqueName="DeviceType" EditFormColumnIndex="1">

<ItemTemplate><asp:Label runat="server" ID="lblDevice" Text='<%# Bind("DeviceDisplayValue") %>'></asp:Label></ItemTemplate>

<EditItemTemplate><telerik:RadComboBox ID="ddlDeviceAW" runat="server" LoadingMessage="Loading Device..." MarkFirstMatch="True" ToolTip="Select a Device"></telerik:RadComboBox></EditItemTemplate>

</telerik:GridTemplateColumn>

I am populating the dropdowns on my ItemCommand event .
If my grid is in edit mode I want to pre select the grid value in the combo box.
I am unable to set that value.

 How can i do that?

3 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 22 Apr 2008, 05:26 PM
You need to bind the SelectedValue of your combobox to the data field for your grid column.
0
newbie
Top achievements
Rank 1
answered on 22 Apr 2008, 05:29 PM
yes but i am not able to get the value of the data field column.
How do i get that?
0
Richard
Top achievements
Rank 1
answered on 22 Apr 2008, 06:28 PM
Well, in the ItemTemplate you are binding to the DeviceDisplayValue, so depending on how you have the data selected to populate your combobox, that might be the field to bind the SelectedValue to.  Does the DataValueField of your combobox correspond to the DeviceDisplayValue?
Tags
Grid
Asked by
newbie
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
newbie
Top achievements
Rank 1
Share this question
or