Solved

DropDownList in ASP.NET Gridview Not Saving Changes Made During UPDATE

Posted on 2013-06-26
2
620 Views
Last Modified: 2013-07-02
I've taken a gridview and replaced several of the fields with dropdownlists.

The Gridview is bound to a SQLDataSource and the dropdownlists are bound to a different SQLDataSource.  Generally I autoload all of the lookup table values into a dataset on page_load and bind my controls to the specific tables in the dataset.  The problem I'm having is because the ddls are inside of the gridview and I can't figure out why the selectedvalue  isn't being saved when I click on the UPDATE button.  It's wasn't originally throwing an exception it's just wasn't saving.  Now it's throwing an exception stating it "Cannot insert the value NULL".  Column does not allow nulls.

Where should I begin troubleshooting this?
0
Comment
Question by:FoxProMari
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
duttcom earned 360 total points
ID: 39280186
Ideally, you should have placed the ddls for editing the data inside an EditTemplateItem inside a template field in the Gridview.

This is a good walkthrough of implementing ddls in a gridview for editing -

http://msdn.microsoft.com/en-us/library/ms178294(v=vs.80).aspx
0
 

Author Closing Comment

by:FoxProMari
ID: 39292362
The link you referenced is the exact one I used for testing - the problem for me seems to be that since the data that populates the ddls comes from tables different than the gridview sqlds table.

I got it working in 2005, but still no go on 2010.  I'm going to go ahead and complete the framework in 2005 and once it's table see about what advantages vs2010 offers (like AJAX for example).

Thanks so much.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question