I have a dropdownlist ("ddlYear") in a formsview that is populated with years (used for the user's birthdate). I set the selectedvalue to:
I also check that the datetime value I'm grabbing from the database is included in the dropdownlist. However, when I load the page it gives me this error:
'ddlYear' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
I bound the item to a text box to see if the year is being grabbed, and it is.
The strange thing is that if I set the selected value to: Right((DataBinder.Eval(Container.DataItem, "BirthDate")), 4)
Any idea why this is happening. I'd prefer to use the "Year" instead of "Right"