J
Jeff
hi
..NET 2.5
On my webpage I have ListBox. When adding items to that ListBox I want for
each item to add an attribute.
( I tryed to use the ListItem.value instead but it doesn't work, it get the
same value as the Text property, so it cannot be NULL, bad idea cause my
code test if the Value is NULL and if NULL then do some logic... )
So instead I'm trying to use AttributeCollection.
ListItem item = new ListItem();
item.Text = "HelloWorld";
item.Attributes.Add("Id", "-1");
ListBox1.Items.Add(item);
Later in my code I try to access that attribute:
string r = item.Attributes["Id"];
There is the problem. Instead of retrieving the value I get NULL
(r = null)
Any ideas what I do wrong here?
..NET 2.5
On my webpage I have ListBox. When adding items to that ListBox I want for
each item to add an attribute.
( I tryed to use the ListItem.value instead but it doesn't work, it get the
same value as the Text property, so it cannot be NULL, bad idea cause my
code test if the Value is NULL and if NULL then do some logic... )
So instead I'm trying to use AttributeCollection.
ListItem item = new ListItem();
item.Text = "HelloWorld";
item.Attributes.Add("Id", "-1");
ListBox1.Items.Add(item);
Later in my code I try to access that attribute:
string r = item.Attributes["Id"];
There is the problem. Instead of retrieving the value I get NULL
(r = null)
Any ideas what I do wrong here?