473,756 Members | 3,390 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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.Dat aSource = dstData.Tables( "Manufactur er")
lstMake.datasou rce = dstData.Tables( "Manufactur er")
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.da tarowview" over and over.

Any help is, as usual, appreciated.
Jun 27 '08 #1
4 5112

"Arch Stanton" <sa**@hill.orgw rote 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.Dat aSource = dstData.Tables( "Manufactur er")
lstMake.datasou rce = dstData.Tables( "Manufactur er")
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.da tarowview" 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.orgw rote 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.Dat aSource = dstData.Tables( "Manufactur er")
lstMake.datasou rce = dstData.Tables( "Manufactur er")
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.da tarowview" 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.orgw rote 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.Da taSource = dstData.Tables( "Manufactur er")
lstMake.dataso urce = dstData.Tables( "Manufactur er")
Page.DataBin d

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.d atarowview" 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.orgw rote 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.Da taSource = dstData.Tables( "Manufactur er")
lstMake.dataso urce = dstData.Tables( "Manufactur er")
Page.DataBin d

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.d atarowview" 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
7485
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 "System.Data.DataR..." is displayed inside the combobox is the amount of records in the dataset. On the other hand, if my query is "select emplcode from payemployee", the databind will work fine (but I don't want to limit the dataset to one field)....
2
1798
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 retrieving the current row, I want to retrieve row 6. How can I modify the above code so that rowViewAudit holds the data from row 6 of the grid?
3
1906
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 eliminate the time. As an example, SQL Server returns: 2004-04-18 00:00:00.000. Instead, I want: 4/18/2004. Is there a way to alter the format in which the DataView displays a table's rows without having to alter data source? As a (hopefully)...
1
2021
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 fine if I use a datagrid for the master, instead of a combobox. But the combobox won't cause the repopulation of the datagrid with the appropriate data. What's the trick? TIA, Larry Woods cross-posted on ...dotnet.languages.vb.controls
2
1762
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 automaticly. If there is only 2 tables, that's quite easy. add the relation "CusVsOrder" to dataset. binding the "patient" with the parent datagrid, binding the relation "customers.CusVsOrder" with the child datagrid. while, now there are 3 tables,...
0
1326
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 hyperlinks in a repeater bound to an objectdatasource with the following code: <asp:HyperLink runat="server" ID="HyperLink1" NavigateUrl='<%# string.Format("~/Products.aspx?page=0&categoryId={0}",
0
1398
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 object. I am currently creating some hyperlinks in a repeater bound to an objectdatasource with the following code: <asp:HyperLink runat="server" ID="HyperLink1" NavigateUrl='<%# string.Format("~/Products.aspx?page=0&categoryId={0}",
0
1396
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, PreBuyDataSource is bound to PreBuyDetailsView control and its parameters come from the session or request. The stored procedure will always only find one row, and I found the DetailsView control to be convenient. The second data source, BudgetDataSource is...
1
6435
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 for the non-foreign key fields. When the user clicks on a row in the listbox, the comboboxes' SelectedItem changes to reflect the foreign key selections in the currently selected row. That part is working fine. I also want the textboxes to change to...
0
10031
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9869
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9708
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.