Lamloumi Afif
Lamloumi Afif

Reputation: 9081

Binding a dataset column to a dropdownlist with Asp.net application

I used a DataSet with a column Ref, I'm trying to bind the values of this column to a dropdownlist

DropDownRef.DataSource = From r In liste.Tables(0).Columns("Ref") Select r
            DropDownRef.DataBind()

But it didn't work :(

  1. So, how can I modify my snippet to do this task?
  2. Is there another idea to do that?

Upvotes: 0

Views: 49

Answers (1)

Tim Schmelter
Tim Schmelter

Reputation: 460238

You are using the DataColumn as datasource. You need to use the data.

DropDownRef.DataSource = From r In liste.Tables(0).AsEnumerable()
                         Select r.Field(Of String)("Ref") 

Upvotes: 2

Related Questions