Hello. I've a little issue to get the combobox as I want it to be.
I have, in a database, a table "colors" (let say it only has an "ID" and "code" fields). I want to populate a radcombobox with a small square of each color.
Here's what I do:
And in the code behind:
It's working but not completly.
I have two main issues:
First: The first "item" of the combobox isnt a color square but text saying "colors". I dont know where it comes from, my guess is it is the name of the table in the database. How can I remove it and have a color square as first item?
Second: More important: I can't select anything... whatever my choice, the selected item will always be the first item (in this case the text "colors"). How can I make a selection on this combobox?
Thanx in advance for yours answers.
I have, in a database, a table "colors" (let say it only has an "ID" and "code" fields). I want to populate a radcombobox with a small square of each color.
Here's what I do:
<
telerik:RadComboBox
ID
=
"rcbProdColors"
Width
=
"60"
runat
=
"server"
MarkFirstMatch
=
"false"
AllowCustomText
=
"false" DataValueField="ID"
>
<
ItemTemplate
>
<
div
style
=
" height:15px;width:15px;border:solid black 1px;background-color: #<%# Eval("
Code")%>"></
div
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
And in the code behind:
Dim
query = (From c
In
db.Colors
Select
c)
rcbProdColors.DataSource = query
rcbProdColors.DataBind()
It's working but not completly.
I have two main issues:
First: The first "item" of the combobox isnt a color square but text saying "colors". I dont know where it comes from, my guess is it is the name of the table in the database. How can I remove it and have a color square as first item?
Second: More important: I can't select anything... whatever my choice, the selected item will always be the first item (in this case the text "colors"). How can I make a selection on this combobox?
Thanx in advance for yours answers.