Asp updating database from dropdown box

31-Aug-2016 11:44

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.

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.

Let's say you have this: As the Gridview binds, everything will be fine up until record #6.

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.

It cannot find a value of "Beverage" to set the Selected Value to, and thus, it says: Hey!

The value of category for this record is "Beverage", but the Drop Down List that is supposed to represent that in the Grid View has no item with a value of "Beverage", and thus, I cannot do Selected Value="Beverage"!!!

I converted the "Categories" column to a template field, and populated it with a dropdown box that pulls the names from my Categories table (and it works surprisingly :)), but just doesn't update. Yes, that's why I wanted to see your Update parameters, because, as I suspected, there's no Control Parameter that passes the selected value of the dropdownlist.

I'd be happy to post more of my code if it would help you out, I just didn't want to flood my post with code that wasn't relevant to the problem. Hence, the Update statement has no idea where to get the @Category value from. Yes, that's why I wanted to see your Update parameters, because, as I suspected, there's no Control Parameter that passes the selected value of the dropdownlist.

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.

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.

Many people all over the net are having this trouble too, and I've tried a ton of things.

I also added Inside the DDL, hoping that if I forced a default value into it, that it would work, but no.

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.

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.

Many people all over the net are having this trouble too, and I've tried a ton of things.

I also added Inside the DDL, hoping that if I forced a default value into it, that it would work, but no.

The FAILURE POINT is that the selected item from the drop down list is not SAVED to the subject tablet record. The code behind that WORKS for creating the substitute drop-down is here, with my notation as to where I am GUESSING I need to do something correctly.