data reader...

A

atif

hi i hav a prob with data reader. i hav a 2 column in a data table n i
hav 2 drop down lists on my page. Now i want to connect my first drop
down with the first column of the data table. Though i got the result
frm the following code

dim ee as System.Data.IDataReader = returnCategory()

dropdownlist1.DataSource = ee
dropdownlist1.DataBind()

returnCategory() return all the records of firstColumn

but the problem is i was expecting that the drop down list will be
filled with column values but it is filled with
"System.Data.Command.DbDataRecord" though the number of the records
return r correct.
 
D

Dan Cooper

You need to specify the fields the drop down list uses as its value and text
items. Use DataValueField and DataTextField as follows:

dropdownlist1.DataSource = ee
dropdownlist1.DataValueField = "id" ' replace with appropriate value
dropdownlist1.DataTextField = "name" ' replace with appropriate value
dropdownlist1.DataBind()

Dan


atif said:
hi i hav a prob with data reader. i hav a 2 column in a data table n i
hav 2 drop down lists on my page. Now i want to connect my first drop
down with the first column of the data table. Though i got the result
frm the following code

dim ee as System.Data.IDataReader = returnCategory()

dropdownlist1.DataSource = ee
dropdownlist1.DataBind()

returnCategory() return all the records of firstColumn

but the problem is i was expecting that the drop down list will be
filled with column values but it is filled with
"System.Data.Command.DbDataRecord" though the number of the records
return r correct.



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top