ListBox problem

C

cindy liu

Hi,

On my ASP.net page, I have a web control list box. In Page_Load method, I
created a ListItem and added it to the list box. Here is the code:

oItem=new ListItem(strAsset);
oItem.Attributes.Add("Area","my area");
lstAsset.Items.Add(oItem);

After clicking Add button on my page, I tried to get selected list item and
retrieve my attribute "Area". I noticed that the list item attribute count is
0. Where is my attribute? Any idea?

Thanks in advance!!!
Cindy
 
C

cindy liu

But I still can get oItem.Text and oItem.Value if I set value when creating
my list item. That means my item is still there, just the custom attributes
are stripped out. Why?

Thanks in advance!!!
Cindy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top