Asp updating database from dropdown box
You can access the Grid Editable Item instance directly using e.
Item argument and depending on your edit mode you can get the values manually: In some scenarios, the Extract Values method can be helpful: you are using templates, make sure that you are using the Bind expression in the form controls in your : you can directly try implementing automatic CRUD operations: hope this will prove helpful.
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.
Parameter name: value] I don't really know what that means, but it seems odd that the DDL couldn't find a value, because it was working fine before I put the Bind command in. Actually, looking at what you're trying to do a bit more closely, it looks like what you have is probably OK.
Based on their suggestions, I also added Append Data Bound Items="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 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.This could be due to a completely missing record, or even a slight typo.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.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.