473,320 Members | 1,872 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,320 software developers and data experts.

ListBox and sqldatasource

Hi,

I have a ListBox that bind to a sql source with managed code?

I know how to print ListBox1.SelectedItem and ListBox1.SelectedValue.
to print two fields from the following select statement.
But how can I print other fields in my select statement? I guess it
should be ListBox1.something...??

Suppose my select statement is like :

"select custid, name1 as firstname, name2 as lastname, address2 as
address from customer where custid=@custid"
Aug 27 '06 #1
3 1473
ListBox is able to bind only to 2 fields from the datasource: one for the
text and another for the value. It has no idea about any other fields. You
can use the selected item to find the row for the item in the datasource and
get other fields from the datasource itself.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<walantawrote in message
news:8a********************************@4ax.com...
Hi,

I have a ListBox that bind to a sql source with managed code?

I know how to print ListBox1.SelectedItem and ListBox1.SelectedValue.
to print two fields from the following select statement.
But how can I print other fields in my select statement? I guess it
should be ListBox1.something...??

Suppose my select statement is like :

"select custid, name1 as firstname, name2 as lastname, address2 as
address from customer where custid=@custid"

Aug 27 '06 #2
I'm not sure I understand your second sentence.
Could you give me an quick example or point me to where I can get the
information or example? Thanks!!!

On Sun, 27 Aug 2006 12:19:38 +0200, "Eliyahu Goldin"
<RE**************************@mMvVpPsS.orgwrote:
>ListBox is able to bind only to 2 fields from the datasource: one for the
text and another for the value. It has no idea about any other fields. You
can use the selected item to find the row for the item in the datasource and
get other fields from the datasource itself.
Aug 27 '06 #3
Asp.Net renders server control ListBox as certain html element rendered by
the client browser. Datasource and databinding is needed to fill up the
element properties. These properties are the text and the value of the items
that the listbox contains. They are taken from the datasource fields. Other
fields that the datasource contains are not needed for the listbox
functionality. They are not available via the listbox.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<walantawrote in message
news:jn********************************@4ax.com...
I'm not sure I understand your second sentence.
Could you give me an quick example or point me to where I can get the
information or example? Thanks!!!

On Sun, 27 Aug 2006 12:19:38 +0200, "Eliyahu Goldin"
<RE**************************@mMvVpPsS.orgwrote:
>>ListBox is able to bind only to 2 fields from the datasource: one for the
text and another for the value. It has no idea about any other fields.
You
can use the selected item to find the row for the item in the datasource
and
get other fields from the datasource itself.

Aug 28 '06 #4

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

Similar topics

5
by: Martin Bischoff | last post by:
Hi, is it possible to modify the values of a SqlDataSource's select parameters in the code behind before the select command is executed? Example: I have an SqlDataSource with a...
0
by: SimonZ | last post by:
If I have gridView and one of the columns is template cpolumn, where I have listBox in edit mode: <asp:TemplateField> <HeaderTemplate>CategorName:</HeaderTemplate> <ItemTemplate> <asp:Label...
4
by: Marcos Beccar Varela | GamaCom Argentina | last post by:
Hello Everyone. I need to use a gridview, that when I use the Update command one of the colums, instead of showing a textbox where the user can write, I need a combobox (listobx), where there are...
3
by: koonda | last post by:
Hi Guys, I have 5 listbox controls which I populated from the database tables. I tried it using the wizard. For all 5 listboxes and a single Repeater I used a SQL DataSourse Object and mapped this...
1
by: Ted | last post by:
Here is a stored procedure I created in MySQL: CREATE PROCEDURE `sp_find_food`( IN search_string varchar(255) ) BEGIN DECLARE ss VARCHAR(257); SET ss = CONCAT('%',search_string,'%'); SELECT...
9
by: zdrakec | last post by:
Hello all: Clearly, I'm not getting it! Here is the scenario: On a web page, I have two list boxen and a text box. The first listbox is populated at page load time (if it is not a postback)....
2
by: glbdev | last post by:
Hi. I am trying to loop thru a listbox and retreive the value for all selected items. Example of listbox items: <option value="1">Item 1</option> <option value="2">Item 2</option> <option...
1
by: murugavelmsc | last post by:
hi, in vs2005, i have a control of gridview and dropdown. in dropdown list have a item of table header which i configured in gridview. In Dropdown box, i selected one header means , it select the...
2
by: Phijo | last post by:
Hello, I am writing a page (C#) that uses one ListBox that retrieves data from a DB using SqlDataSource and the SelectCommand. <asp:SqlDataSource ID="DataSource1" SelectCommandType=Text...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.