Home

Clearing DropDown Selections in ASP.NET Not yet rated

rate email bookmark Print del.icio.us technorati stumbleupon simpy

Avoid the "Cannot have multiple items selected in a DropDownList" error message

Clearing dropdowns in ASP.NET using C# is SO very simple, yet it's something I find myself having to look up time and time again. Maybe there's a deficiency in my brain or perhaps it's such a simple solution to a common problem that my brain decides it doesn't need to remember it. No matter what the case is, I always feel like a complete idiot when I build an application only to have it crash with that ugly Cannot have multiple items selected in a DropDownList error message. Ugh. Below is the simple one-line call to resolve this common dilemma.

Clearing dropdowns

//Clear dropdown selection
ddlCodeFileSelection.ClearSelection();

That couldn't be any simpler, could it? Now you can avoid the Cannot have multiple items selected in a DropDownList error message by clearing your dropdown selection before making a new selection programmatically.

More information


David Nicolosi
Drop-In Code
Back to index