Solved

Trouble getting a FormView to update with a Dataset datasource

Posted on 2008-10-23
3
931 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error on Add method 1 38
Javascript and Jquery not firing 9 43
Help with C#, MVC, razor. 6 23
VB.NET 2008 Populate DataModel with DataTable 44 13
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

864 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

22 Experts available now in Live!

Get 1:1 Help Now