Databinding dropdown on postback?

D

darrel

I'm having this problem:

http://west-wind.com/weblog/posts/2068.aspx

On a postback, I'm trying to populate a drop-down list. I have this:



1 DDL_SubCategory.Enabled = true

2 DDL_SubCategory.DataSource = DS

3 DDL_SubCategory.DataTextField = "categoryName"

4 DDL_SubCategory.DataValueField = "categoryID"

5 DDL_SubCategory.DataBind

6 DDL_SubCategory.Items.Insert(ds.Tables(0).rows.Count, New
ListItem("-none-", 0))



It actually seems to populate the drop-down, but pukes on line 5 with this:
Specified argument was out of the range of valid values. Parameter name:
value

Looking at the link above, it appears to be some odd issue with the fact
that I'm doing this on a postback. But I can't quite decipher an answer on
that page.

I've been staring at this for about an hour...and will continue to do so,
but thought I'd toss this to the group in case there's maybe a common thing
I should be checking for.

-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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top