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

D

darrel

What does this error mean?

Specified argument was out of the range of valid values. Parameter name:
value
System.Web

It's being thrown here:

DDL_SubCategory.Enabled = True
DDL_SubCategory.DataSource = DS
DDL_SubCategory.DataTextField = "categoryName"
DDL_SubCategory.DataValueField = "categoryID"
DDL_SubCategory.DataBind()
DDL_SubCategory.Items.Insert(DS.Tables(0).Rows.Count, New ListItem("-none-",
0))

It's happening on the DDL_SubCategory.DataBind() line. There's no parameter
there, so I'm confused as to what is the problem.

After some googling, the answer seems to be to add this line before the
databind:

DDL_SubCategory.SelectedValue = Nothing

That works! But I don't know why. Can anyone explain?

-Darrel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top