Register   |   Login

 

Spark Your Solution

 Scott's Technology Blog Minimize

By Scott Davis on 4/2/2008 10:38 PM

While doing a little Ajax web programming, I hit this javascript error that stumped me longer than I care to admit.  Unfortunately the javascript error doesn't tell you which dropdown has the multiple selection, so not a trivial one to debug if you have several controls in the mix.

Error:  "Sys.WebForms.PageRequestManagerServerErrorException: Cannot have multiple items selected in a DropDownList."
 
I was changing the selected values based on other activity in the form.  Because I was using AJAX (which uses Javascript to do the magic), not your typically web request that would re-populating the drop down list all over again on the server side, I was causing the error by using the code below.  Note: the drop down list remembered the selected item from the last web request.  Setting the selected property of one item, doesn't clear the other selected flags.

foreach (ListItem ... Read More »

 Print   
 Blog Dates Minimize

 Print   
 Search Minimize

 Print