Adding custom options in binded dropdown in asp.net

Posted by MarceloRamires on Stack Overflow See other posts from Stack Overflow or by MarceloRamires
Published on 2010-04-05T19:56:40Z Indexed on 2010/04/05 20:03 UTC
Read the original article Hit count: 795

I have a bound dropdown list populated with a table of names through a select, and databinding. it shoots selectedindexchanged that (through a postback) updates a certain gridview.

What happens is, since it runs from changing the index, the one that always comes selected (alexander) can only me chosen if you choose another one, then choose alexander. poor alexander.

What I want is to put a blanc option at the beginning (default) and (if possible) a option as second.

I can't add this option manually, since the binding wipes whatever was in the dropdown list and puts the content of the datasource.

© Stack Overflow or respective owner

Related posts about dropdownlist

Related posts about c#