Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

Noob question - binding data to list box (system.data.datarowview?)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arch Stanton - 17 Apr 2008 16:51 GMT
I'm trying to bind data in a dataset (obtained from an Access DB) to a
listbox in ASP.net. I know my dataset is being created properly because
it displays fine in a datagrid, but I can't get it to display in a
listbox. Here's what I'm trying:

dgrDataGrid.DataSource = dstData.Tables("Manufacturer")
lstMake.datasource = dstData.Tables("Manufacturer")
Page.DataBind

There is only one column in the dataset's table, and the datagrid
displays it the way I want. But my listbox just repeats the line
"system.data.datarowview" over and over.

Any help is, as usual, appreciated.
Lloyd Sheen - 17 Apr 2008 17:23 GMT
> I'm trying to bind data in a dataset (obtained from an Access DB) to a
> listbox in ASP.net. I know my dataset is being created properly because it
[quoted text clipped - 10 lines]
>
> Any help is, as usual, appreciated.

You need to tell the listbox what to display.  The default is the .toString
so you are getting the object type as each occurence.

LS
Arch Stanton - 18 Apr 2008 06:33 GMT
Replies solved my problem. You guys rule.

-Grateful Noob :|

>> I'm trying to bind data in a dataset (obtained from an Access DB) to a
>> listbox in ASP.net. I know my dataset is being created properly
[quoted text clipped - 15 lines]
>
> LS
David Wier - 17 Apr 2008 18:03 GMT
You need to tell it, from the dataset you get returned what to display and
what to assign to the 'value' of the item
Like Product for DataTextField and ProductID for DataValueField

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup

> I'm trying to bind data in a dataset (obtained from an Access DB) to a
> listbox in ASP.net. I know my dataset is being created properly because it
[quoted text clipped - 10 lines]
>
> Any help is, as usual, appreciated.
Arch Stanton - 18 Apr 2008 06:32 GMT
Replies solved my problem. You guys rule.

-Grateful Noob :|

> You need to tell it, from the dataset you get returned what to display and
> what to assign to the 'value' of the item
[quoted text clipped - 19 lines]
>>
>> Any help is, as usual, appreciated.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.