Drop Down List Box Insert

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a drop down list box on a web form. I need to insert an entry:

COF-ALL

into the list box and have it appear nefore all other entries that contain COF.

How do I do this?

Thanks,

dave
 
Dave,

You should just be able to call the Add method on the ListItemCollection
that is returned by the Items property. However, if you are binding to a
data source, you might have to modify the source (through the query in the
case of a DataAdapter or the DataSet itself) in order to insert this.
Otherwise, you will have to add the items manually to the list.

Hope this helps.
 
Hi dave,


You have to iterate in the Items collection until you find the correct
position, after that you just use the Insert( ) method.

Cheers,
 
I did it this way.

Thanks,

Dave

Ignacio Machin ( .NET/ C# MVP ) said:
Hi dave,


You have to iterate in the Items collection until you find the correct
position, after that you just use the Insert( ) method.

Cheers,
 
Back
Top