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

ComboBox Multi column with linq

2 Answers 78 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
daouddajani
Top achievements
Rank 1
daouddajani asked on 07 May 2008, 08:00 AM

i need to bind the combo box to a linq datasouce and when clicked it show a 2 cols dropdown.

i keep getting error message on the e.Item.DataItem conversion what should the ????? be ?

Protected Sub RdProviders_ItemDataBound(ByVal sender As Object, ByVal e As RadComboBoxItemEventArgs)

Dim ds As New mobilesdcDataContext

e.Item.Text =

DirectCast(e.Item.DataItem, ?????)("ProviderExtension").ToString() + "; " + (DirectCast(e.Item.DataItem, ??????))("ProviderName").ToString()

e.Item.Value = (

DirectCast(e.Item.DataItem, ?????))("ProviderExtension").ToString()

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not Page.IsPostBack Then

Dim ds As New mobilesdcDataContext

Dim result = From p In ds.Providers_tbls Select p

rbProviders.DataSource = result.ToList

rbProviders.DataTextField =

"ProviderName"

rbProviders.DataValueField =

"ProviderExtension"

rbProviders.DataBind()

End If

End Sub

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 May 2008, 01:03 PM
Hi,

Go through the online demo given below.
Multi-column Combo

Princy.
0
Rosi
Telerik team
answered on 07 May 2008, 01:41 PM
Hi ,

e.Item.DataItem has to be converted to  DataRowView object.

Example:
(DirectCast(e.Item.DataItem, DataRowView))

Regards,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox
Asked by
daouddajani
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Rosi
Telerik team
Share this question
or