View Single Post
  #8 (permalink)  
Old March 13th, 2009, 02:13 AM
RushNP774 RushNP774 is offline
Authorized User
Join Date: Mar 2009
Posts: 23
Thanks: 2
Thanked 0 Times in 0 Posts

Originally Posted by Lee Dumond View Post
Actually, looking at what you're trying to do a bit more closely, it looks like what you have is probably OK. From here, you should be able to simply bind the SelectedValue property of the DropDownList using two-way databinding, like this:
Thanks Lee, I tried that, but no dice. I had a huge reply typed to you that explained a bunch of things I tried, but vBulletin doesn't save your ViewState, and I lost it . Long story short, I added the SelectedValue property to my DDL, and got this error:

ArgumentOutOfRangeException: 'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value

I'm guessing that it's because the instant the GridView goes into edit mode, the DDL is created but has a null value in it because it hasn't pulled the data from the DataSource yet. Many people all over the net are having this trouble too, and I've tried a ton of things. I also added

<asp:ListItem Value="0">Select Category</asp:ListItem>
Inside the DDL, hoping that if I forced a default value into it, that it would work, but no. I guess the Bind command tries to run before I have the chance to populate the DDL at all.

Based on their suggestions, I also added AppendDataBoundItems="True" to it, but it doesn't really fix anything. Funny though, when I run the site after adding that, but without the Bind command, the process runs without errors, but the row doesn't update.

I appreciate your sticking with this.

Last edited by RushNP774; March 13th, 2009 at 02:18 AM..