Hence, the Update statement has no idea where to get the @Category value from. I'm not new to programming, just new to C#, so I have a decent handle on program logic and the flow. NET is just so new to me that I don't know many of the intricacies of how to accomplish even the most basic stuff.
This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. The [Category] field is populated by a dropdown list box that gets the categories from another table (and it works fine).
NET 3.5 Basics section of the Wrox Programmer to Programmer discussions.
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 Append Data Bound Items="True" to it, but it doesn't really fix anything.
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.When I update a record, I can change the [Name] of the activity (because it's a default textbox generated by the Grid View), and the record is updated fine.But the value of the ddl box is not inserted into the record.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.Many people all over the net are having this trouble too, and I've tried a ton of things.