Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

how to make dropdownlist select manually inserted value

$
0
0
Hi, have following situation:
Using a dropdownlist with sqldatasource as source for selectedvalue and objectdatasource as source for the listitems.
I have added 1 item to the dropdownlist in the aspx page. It doesn't show up on the page though. I'm guessing the databind clears the listitems, but where is the best place to put it then?
If I get a null value from the sqldatasource, I need to select the manually added item. If not, I need to select an item from the databound listitems. Of course, if the manually added item stays selected, I need to return that null value back to the sqldatasource for insert/update. Guessing that last part needs to be done in the inserting/updating eventhandler of the sqldatasource, but otherwise, I'm not really sure what to do.
Using the customized dropdownlist I got from the Microsoft website(Customized Dropdownlist), I have fixed the problem that an exception was thrown every time I tried to select the manually inserted item, but it doesn't show on the page.
 
Anyone care to help me out here?
Thanks.

Viewing all articles
Browse latest Browse all 3938

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>