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

[Solved] bind 2 value

1 Answer 125 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
casa51
Top achievements
Rank 2
casa51 asked on 29 Sep 2009, 05:13 PM
hi,
i try to put 2 value in my combobox :
I have a table with 3 value : ModelCode , Model , Modelyear
I do this and this work well :

-------------------------------------------------------------------------------

 

Protected Sub LoadModele(ByVal MakecodeID As String)

 

 

Dim connection As SqlConnection = CreateConnection()

 

 

Dim adapter As New SqlDataAdapter("SELECT * FROM MODEL WHERE Makecode=@Makecode ORDER By Model asc", connection)

 

adapter.SelectCommand.Parameters.AddWithValue(

"@Makecode", MakecodeID)

 

 

Dim dt As New DataTable()

 

adapter.Fill(dt)

RadComboBox2.DataTextField =

"Model"

 

RadComboBox2.DataValueField =

"ModelCode"

 

RadComboBox2.DataSource = dt

RadComboBox2.DataBind()

 

End Sub
--------------------------------------------------------------------------------------------
but I want to see in DATATEXTFIEL (model & modelyear) how to write them
I trie : RadComboBox2.DataTextField = "Model" & "Modelyear"
but they not work

Thanks for your help
(excuse for my englih)

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 30 Sep 2009, 06:01 AM
Hi Dartus,

You could use custom attribute to RadComboBoxItem in order to get the corresponding modalyear and set the text accordingly. Refer the following links to know more about custom attributes.
Documentation: Custom Attributes
Demo: ComboBox / Custom Attributes

Also refer the forum link that might help: Third value

-Shinu.
Tags
ComboBox
Asked by
casa51
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or