Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Objects to ListBoxes

Status
Not open for further replies.

FederalProgrammer

Programmer
Jul 2, 2003
318
CA
I have an object w/ the following attributes:
Code:
NickName 
Email 
AccountBalance

I want to add instances of this object to a ListBox control such that, NickName property of the object is displayed; However, when the user selects the object from the ListBox, I want to be able to access all of its attributs (NickName, Email, and AccountBalance).


This is done quite simply for Desktop applications. But I'm not sure how to do this in ASP.NET! Any ideas?




---------------
 
This one is easy: you can't.

An asp.net drop list is still just an HTML drop list when it renders on the page. That means that what you're really filling it with is:

Code:
<select name="DropDownList1" id="DropDownList1">
<option value="value">text</option>
</select>

You could put in some custom string in the value part, like:
name:myname,color:blue
and then have custom parser code...you could do XML too, but then you have to lower your apps security settings.

D'Arcy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top