Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to deal with dropdownlist problem
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Web forms
Title:
How to deal with dropdownlist problem
Miscellaneous
Thread ID:
00955764
Message ID:
00955764
Views:
50
I was wondering if someone knows how to get around the following problem.

I have a dropdownlist (ddl) on a web form. The dropdownlist is bound to a dataset (dataview) of two columns (but I think the problem would be the same with one column too). Property .DataValueField of the ddl is set to one of the column names, MYFLD. When web form is initialized, a default value is set to the property .SelectedValue.

The problem is that if the default value set in the .Selectedvalue property is not in the dataset, web form bombs with error:
Specified argument was out of the range of valid values.
Is there a way to make dropdownlist still accept the value even if it is not in the dataset to which dropdownlist is bound?

Thank you in advance for any suggestions.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Next
Reply
Map
View

Click here to load this message in the networking platform