Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Noob question - binding data to list box (system.data.datarowview?)
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.

Report this thread to moderator Post Follow-up to this message
Old Post
Arch Stanton
04-18-08 12:35 AM


Re: Noob question - binding data to list box (system.data.datarowview?)
"Arch Stanton" <e@hill.org> wrote in message
 news:zZCdnSmRF8Ka75rVnZ2dnUVZ_sWdnZ2d@co
mcast.com...
> 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.

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


Report this thread to moderator Post Follow-up to this message
Old Post
Lloyd Sheen
04-18-08 12:35 AM


Re: Noob question - binding data to list box (system.data.datarowview?)
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


"Arch Stanton" <e@hill.org> wrote in message
 news:zZCdnSmRF8Ka75rVnZ2dnUVZ_sWdnZ2d@co
mcast.com...
> 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.



Report this thread to moderator Post Follow-up to this message
Old Post
David Wier
04-18-08 12:35 AM


Re: Noob question - binding data to list box (system.data.datarowview?)
Replies solved my problem. You guys rule.

-Grateful Noob :|



David Wier wrote:
> 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
>
>
> "Arch Stanton" <e@hill.org> wrote in message
>  news:zZCdnSmRF8Ka75rVnZ2dnUVZ_sWdnZ2d@co
mcast.com... 
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Arch Stanton
04-18-08 10:05 AM


Re: Noob question - binding data to list box (system.data.datarowview?)
Replies solved my problem. You guys rule.

-Grateful Noob :|



Lloyd Sheen wrote:
>
> "Arch Stanton" <e@hill.org> wrote in message
>  news:zZCdnSmRF8Ka75rVnZ2dnUVZ_sWdnZ2d@co
mcast.com... 
>
> 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

Report this thread to moderator Post Follow-up to this message
Old Post
Arch Stanton
04-18-08 10:05 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

ASP .NET archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:33 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.