473,756 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Binding dataset to a ListBox.

Hi,

In ASP.Net C# windows form, how do I bind a DataSet to a ListBox so the
ListBox will display data?
Thanks for help.

Jason
Nov 17 '05 #1
4 2946
"Jason Huang" <Ja************ @hotmail.com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
In ASP.Net C# windows form


ASP.NET uses WebForms, not WinForms.

Are you talking about binding a datasource to an <asp:ListBox /> WebControl
on an ASPX page?

Please clarify...
Nov 17 '05 #2
"Jason Huang" <Ja************ @hotmail.com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
In ASP.Net C# windows form


ASP.NET uses WebForms, not WinForms.

Are you talking about binding a datasource to an <asp:ListBox /> WebControl
on an ASPX page?

Please clarify...
Nov 17 '05 #3
listBoxName.Dat aSource = DataSet.Tables[TableIndex];
listBoxName.Dat aTextField = "FieldName" ;
listBoxName.Dat aValueField = "FieldName" ;
listBoxName.Dat aBind();
"Jason Huang" <Ja************ @hotmail.com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
Hi,

In ASP.Net C# windows form, how do I bind a DataSet to a ListBox so the
ListBox will display data?
Thanks for help.

Jason

Nov 17 '05 #4
listBoxName.Dat aSource = DataSet.Tables[TableIndex];
listBoxName.Dat aTextField = "FieldName" ;
listBoxName.Dat aValueField = "FieldName" ;
listBoxName.Dat aBind();
"Jason Huang" <Ja************ @hotmail.com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
Hi,

In ASP.Net C# windows form, how do I bind a DataSet to a ListBox so the
ListBox will display data?
Thanks for help.

Jason

Nov 17 '05 #5

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

Similar topics

3
1611
by: me | last post by:
I've included a picture below to show what I am trying to accomplish. It is best to copy/paste into notepad to get the spacing correct. I have a dataset that contains 3 tables. Two of the tables contain data and the third links them together. The dataset has a constraint setup as well. The first listbox and the first and last name text box are bound to the Person DataTable. As you select a name in the listbox, the textbox will be...
10
3094
by: ShadowsOfTheBeast | last post by:
hi all i am trying to bind data to my datagrid from a listbox which i think it should work but an error is coming up saying i have to bind to a datasource that implements the Inumerable or icollection...but i thought list boxes did implement one of the above as they do have their items collection property, can anyone help?
0
973
by: Federico Bari | last post by:
Hi all, I have popolate a listbox using a table of a dataset; but i'm not able to bind the selected value of the listbox to another table record. What I need is to bind the value of the clicked item of the lits box to a specific coloumn of a table in dataset. I tried with listBox03GENG01000.DataBindings.Add("SelectedItem",db,"GEN01.03GENG01000");
3
52924
by: Scott | last post by:
I'm trying to bind my listbox to a SQL query like this: using (SqlConnection conn = new SqlConnection(CONN_STR)) { using (SqlDataAdapter da = new SqlDataAdapter("roboticSiteNames", conn)) { DataSet ds = new DataSet(); da.Fill(ds); DataTable dt = ds.Tables;
8
3927
by: Richard L Rosenheim | last post by:
I have a dataset containing a parent table related to a child table. The child table contains an ID field (which is configured as autonumber in the datatable), the ID of the parent, plus some addition fields. I'm able to get the datagrid to be properly populate with only the child records relating to the specified parent by setting the ..DefaultView.RowFilter property. Currently, to properly add a new child record, I need to manually...
3
1648
by: Peter | last post by:
OK, so in addition to the problem I mentioned before (c.f. "Data Binding to Textbox"), I realized that my comboboxes are not really bound to the internal data set. They are just set to manually change to reflect whatever the selected row's foreign keys are. So the question is, how can I bind the SelectedItem of a combobox, which is filled with DataRowView objects from its bound table, to a field in whichever row of a dataset happens to...
0
1369
by: derndeh | last post by:
I am using VS 2003. I have two tables, BookOrders and BookInfo. BookOrders holds order info which would contain a book Id. Book info will contain the details such as a books title. I want to bind a listbox to the BookOrders table but set the DisplayMember property to the BookTitle column in the BookInfo Table. This is what I've tried: listbox.DataSource = dataset.BookOrders.Select("BookID = '12345'"); listbox.DisplayMember =...
4
2170
chathura86
by: chathura86 | last post by:
Hi i have bounded a dataset to a listbox and i want to get the selected values when i clicked add and write them to a text box. here is the code i'v used Imports System.Data.SqlClient Public Class frmContactList Private conContacts As SqlConnection Private cmdContacts As SqlCommand Private dtaContacts As SqlDataAdapter
4
5112
by: Arch Stanton | last post by:
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
0
9455
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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...
1
9838
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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
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...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.
3
2665
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.