From here, you should be able to simply bind the Selected Value property of the Drop Down List using two-way databinding, like this: I tried that and pretty sure I entered it exactly as you typed it (copy & paste FTW).It compiled fine, but when I went to "edit" the record, I received 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. Oh well, I'll keep at it, because this should be an easy fix. File/9f0ae2/gridview-edit-delete-and-update-in-Asp-Net/ I hopt it 's helpful to you.Best Regards, Klein zhang Thank you very much for creating this example.
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 tried this on the Northwind sample database and it definitely works. The reason you are getting this error is that you have Categories in the ID-Name-Category table that do not exist in the seperate Categories table.
I'm using the auto generated edit feature of Grid View and the edit button appears, clicking it enters edit mode but making changes and clicking update does nothing.
As far as I can tell On Row Editing triggers but On Row Updating does not. I have tested my Update Command on the SQL database directly and it works as intended.
Setting the code below into the validated field and button resolved the issue.
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).
Could you be so kind as to point me to a tutorial that might help me out? Actually, looking at what you're trying to do a bit more closely, it looks like what you have is probably OK.