Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specified argument was out of the range of valid values.

Status
Not open for further replies.

SonJ

Programmer
Oct 24, 2002
166
GB
Hi,

Can anyone tell me how I can resolve the following error.

Specified argument was out of the range of valid values. Parameter name: 1

The error occurs when I try to set the selected value of a dropdown list to the value saved in the database.

ie. selDay.selectedValue=objDR("Date")

I have tried to parse the value before I assign it to the dropdown list, but this does not seem to help.

If anyone has any insights on how this can be resolved, your input would be much appreciated.

Thanks in advance.
SonD



 
Does this sound like what you are trying to do?

Code:
myList.SelectedIndex = myList.Items.IndexOf(myList.Items.FindByValue(myValue))

HTH

David
[pipe]
 
If your ddl contains just dates without time but the data reader pulls datetime field, then it's possible that the matching value won't be found in the dropdown. Try this:
Code:
ie.selDay.selectedValue = (Convert.ToDateTime(objDR("Date")).ToShortDateString();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top