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=@dotnet.itags.org.custid"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:8a12f2595aq9l6rqgvo65qhe39liqt57v9@.4ax.com...
Quote:
Originally Posted by
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"
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"
<REMOVEALLCAPITALSeEgGoldDinN@.mMvVpPsS.orgwrote:
Quote:
Originally Posted by
>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.
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:jnk3f2lt8j9qqrl37ktr9t899kq44mb60j@.4ax.com...
Quote:
Originally Posted by
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"
<REMOVEALLCAPITALSeEgGoldDinN@.mMvVpPsS.orgwrote:
>
Quote:
Originally Posted by
>>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.
0 comments:
Post a Comment