Hi Guys
I have a combo box in the edit item of a grid column, and I wanted to combine two column values to provide the DataTextField content.
It does sort of work, in that the values in the drop down box are as expected, but after one of them is selected, the combox is empty instead of showing the selected value. You can see I tried to use a modified query in the SQL datasource as the simplest way, but obviously it is not the complete answer. Can you put me on the right track?
Code is as below.
Thanks
Clive
I have a combo box in the edit item of a grid column, and I wanted to combine two column values to provide the DataTextField content.
It does sort of work, in that the values in the drop down box are as expected, but after one of them is selected, the combox is empty instead of showing the selected value. You can see I tried to use a modified query in the SQL datasource as the simplest way, but obviously it is not the complete answer. Can you put me on the right track?
Code is as below.
Thanks
Clive
<
asp:SqlDataSource
ID
=
"SqlDataSource2"
runat
=
"server"
ConnectionString="XXXXXX"
SelectCommand="SELECT [AuthCode], ([FirstName] + [LastName]) AS [Name] FROM [Authors]
ORDER BY [LastName], [FirstName]">
</
asp:SqlDataSource
>
<
telerik:GridTemplateColumn
DataField
=
"AuthCode"
HeaderText
=
"AuthCode"
SortExpression
=
"AuthCode"
UniqueName
=
"AuthCode"
Visible
=
"False"
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
DataSourceID
=
"SqlDataSource2"
DataTextField
=
"Name"
DataValueField
=
"AuthCode"
SelectedValue='<%# Bind("AuthCode") %>'
Width="200px" AllowCustomText="True" EmptyMessage="Pick author">
</
telerik:RadComboBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"AuthCodeLabel"
runat
=
"server"
Text='<%# Eval("AuthCode") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>