473,386 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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.
Jun 27 '08 #1
4 5041

"Arch Stanton" <sa**@hill.orgwrote in message
news:zZ******************************@comcast.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

Jun 27 '08 #2
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" <sa**@hill.orgwrote in message
news:zZ******************************@comcast.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.

Jun 27 '08 #3

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" <sa**@hill.orgwrote in message
news:zZ******************************@comcast.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.

Jun 27 '08 #4
Replies solved my problem. You guys rule.

-Grateful Noob :|

Lloyd Sheen wrote:
>
"Arch Stanton" <sa**@hill.orgwrote in message
news:zZ******************************@comcast.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
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Omar | last post by:
When I try to databind my comboBox (specifically field "emplcode") to a filled dataset , the contents of the comboBox displays a bunch of "System.Data.DataRowView". I assume the amount of times...
2
by: VMI | last post by:
I'm currently using Binding manager to get the current datagrid row the user clicked on: DataRowView rowViewAudit = (DataRowView) ((CurrencyManager)BindingContext).Current; But, instead of...
3
by: Eric Lemmon | last post by:
Greetings, I have a VB.NET Windows app where I bind a listbox to a DataView column that contains date values. In this list, however, only the date (not the time) is relavent, so I want to...
1
by: Larry Woods | last post by:
I have a combobox that is populated with a list of names. When a name is selected I want to populate a datagrid with name information. I have my master-detail defined in my dataset and it works...
2
by: yuanh23 | last post by:
Hi, I have 3 talbes "customers","orders","details". i wanna to use 3 datagrids to show those tables. and when the selected row in parent talbe changes, the selected row in child table changes...
0
by: John Davis | last post by:
Hi all, hope you are well. I would like to know if I can access the strongly typed properties of my datatable when binding through the ObjectDataSource object. I am currently creating some...
0
by: John Davis | last post by:
Hi all, hope you are well.(not sure if this posted the first time) I would like to know if I can access the strongly typed properties of my datatable when binding through the ObjectDataSource...
0
by: aarnan | last post by:
I have two SqlDataSources that use two different stored procedures that take parameters to populate two controls, one dependant on an element of the other. The first data source,...
1
by: Peter | last post by:
Hi, I'm trying to create a form that shows table rows in a listbox. Several comboboxes expand the foreign key fields into text values from the parent tables, and there are also some textboxes...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.