Solved

Trouble getting a FormView to update with a Dataset datasource

Posted on 2008-10-23
3
921 Views
Last Modified: 2013-12-17
I have a Formview control that is databound to a dataset.  When I click on the "Update" button, it appears that there is no way to access the bound data or I'm just not seeing it.  I am handling the _ItemUpdating event.  Given my control name is FormView1, how can I get to the databound fields and their data?
0
Comment
Question by:jvalescu
  • 2
3 Comments
 
LVL 6

Expert Comment

by:WanaBRich
ID: 22785814
What do you want to do? for instance do you want to change a 1 or 0 in the DB to desplay "yes" or "no"

0
 

Author Comment

by:jvalescu
ID: 22786554
I have an Order Entry form with an Order Entry Header table and an Order Details table.  The user adds a new header record by filling in some textboxes and hitting "Save", creating the Order Header record and returning an Order ID.  This is the related key to the Order Details table.  Since there is no data in the Order Details table at this time, I could not get a FormView or GridView to populate.  Messing around with the EmptyDataTemplate for both didn't work out at all (ex. The FormView would show the fields, but when I hit "Edit", it did nothing.)  So I decided to do things "manually"; create a blank record in a dataset and use it as the Datasource for the Formview.  This worked OK.  I could even edit the record.  Now, when I hit "Update" to commit my changes, I want to be able to pull the data from the FormView dataset and commit them to the SQL database.  Sounds cludgy, but it was very frustrating.  So that's the long answer to your short question, unless you have a better idea...........................  Thanks!
0
 
LVL 6

Accepted Solution

by:
WanaBRich earned 500 total points
ID: 22786665
You could put a defalut record in the Order Details table that has a ID of 1 lets say. You could populate that table with some thing like "No details available yet" Then when you create the first new header you can manually put in the default ID of 1 then you can chech to see if the ID = 1 on a edit and if it does then created a new record and replace the FK with the correct ID.

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now