[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

Extended property in listbox item

user_google

2/13/2004 2:54:00 PM

Hello Everybody,

I am a new bie in ASP.NET. I am populating a listbox control using a
datareader. I set the Value field and text field in the properties
dialog box. I would like to store some other properties with respect
to each item in the list from the data reader. For example my select
statement contains col1, col2, col3 from tableA. I assigned "col1" as
my value field and "col2" as my text field. I would also like to
assign "col3" value to the listitem. Is there any other property in
the listbox where I can assign this value and retrive it after
submitting the form. I remember doing similar thing in VC++ which was
atleast 6 years before. Thanks in advance.
2 Answers

Ken Cox [MS MVP]

2/17/2004 3:40:00 AM

0

One trick is to store the extra data as part of the value property and
separate each portion of data by a character such as the pipe (|). When you
get the value, just parse out the info that you have delimited.

"Google User" <user_google@hotmail.com> wrote in message
news:b4035584.0402130654.2da596c0@posting.google.com...
> Hello Everybody,
>
> I am a new bie in ASP.NET. I am populating a listbox control using a
> datareader. I set the Value field and text field in the properties
> dialog box. I would like to store some other properties with respect
> to each item in the list from the data reader. For example my select
> statement contains col1, col2, col3 from tableA. I assigned "col1" as
> my value field and "col2" as my text field. I would also like to
> assign "col3" value to the listitem. Is there any other property in
> the listbox where I can assign this value and retrive it after
> submitting the form. I remember doing similar thing in VC++ which was
> atleast 6 years before. Thanks in advance.

Barry

2/19/2004 3:26:00 PM

0

Another option:
listItem.Attributes.Add("col3", col3) when it is created
and use list.Attributes["col3"] to access the value in the code behind.