How do i add Attributes to System.Web.UI.WebControls.ListItem

  • Thread starter Thread starter Murali Inguva
  • Start date Start date
M

Murali Inguva

Hi,
I tried to add attributes to List Item. The I am trying to add that list
item to dropDown
I dont know why the values are not coming. My code goes some thing like
this.
lst = new System.Web.UI.WebControls.ListItem();

lst.Attributes.Add("defaultAmount", item.defaultAmount.ToString());

lst.Attributes.AddAttributes();

lst.Text= item.itemDescription + " -- " + item.defaultAmount.ToString("c") ;

lst.Value=item.itemId.ToString();

cboItems.Items.Add(lst);



Please help me
 
Hi,

it shoulb like that :
ListItem oli = new ListItem ("text","value");
this.ListBox1.Items.Add (oli);

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
Hi,

I see, you need to create your own listbox derived from ListBox and
implement it. this task is not trivial, I suggest you put your hands on
"Developing Microsoft ASP.NET Server Controls and Components "
By Nikhil Kothari, Vandana Datje
Publisher : Microsoft Press
Pub Date : September 28, 2002
ISBN : 0-7356-1582-9.

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
Back
Top