Gridview edit not updating

I'm pretty sure I need to change my Update Command of the sql Data Source that feeds my Grid View, and/or add code to my dropdown box's but I'm at a loss of how to do that.Here is the template field of my Grid View: "UPDATE [Activity] SET [Name] = @Name, [Category] = @Category WHERE [Id] = @original_Id AND [Name] = @original_Name AND (([Category] = @original_Category) OR ([Category] IS NULL AND @original_Category IS NULL))"I've seen similar questions asked many times, but can't seem to find one that's exactly my problem.It cannot find a value of "Beverage" to set the Selected Value to, and thus, it says: As long as I'm not in edit mode, my Grid View pulls the data from my Category column (in [Activities] table), and displays it fine.The problem simply comes when I go to edit the item.Look for this in your data, and you will be able to fix the problem.After you do that, you should PREVENT this problem from happening by establishing a foreign key relationship between the two tables, and ONLY storing the IDs from Table 2 in Table 1. The reason you are getting this error is that you have Categories in the ID-Name-Category table that do not exist in the separate Categories table.

Record number 6 will attempt to set the Selected Value of the Drop Down List to "Beverage", but it will fail because the Drop Down list is bound the the Categories table, and thus contains only the Items Fuit, Car, and Bread.In other words: By establishing a key relationship between the tables, you will never be able to store a Category ID in Table 1 which does not already exist as a, ID in Table 2. This could be due to a completely missing record, or even a slight typo.I understand what you are saying, but I don't think that's the case.Long story short, I added the Selected Value property to my DDL, and got this error: Argument Out Of Range Exception: 'Drop Down List1' has a Selected Value 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 Grid View goes into edit mode, the DDL is created but has a null value in it because it hasn't pulled the data from the Data Source yet.

Search for gridview edit not updating:

gridview edit not updating-24

Maybe I'm thinking that "Binding" is doing something a bit differently than what I intend.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “gridview edit not updating”

  1. After having been on Asian Single Solutions for 6 months I Most of our events include optional ice breaking activities such as speed dating, lock and key or card matching games to help you meet as many people as possible.

  2. The series includes two two-part episodes ("Nevada Day" and "The Harriet Dinner") and a story arc called "K & R" (kidnap & ransom) which spanned three episodes and concluded in a fourth, the final episode of the season.