Solved

Execute Update on multiple FormViews

Posted on 2009-05-14
7
362 Views
Last Modified: 2013-12-17
Greetings all

I have a page with 4 formview controls on it. Each FormView has an EditTemplate with Update and Cancel buttons. Iwould liek to provide "Update All" and "Cancel All" buttons.

How do I get these buttons to execute the commands associated with the respective Update/Cancel buttons in each of the formviews?

In advance, thanks!!

     allanmark
0
Comment
Question by:allanmark
  • 5
  • 2
7 Comments
 
LVL 8

Accepted Solution

by:
ppittle earned 350 total points
ID: 24386907
<asp:Button ID=UpdateAllButton" runat="server" Text="UpdateAll" OnClick="UpdateAllButton_Click" />
<%-- Code Behind --%>

protected void UpdateAllButton_Click (object sender, EventArgs e)
{
bool doValidation = true;
//Call the Update method on each FormView:
FormView1.UpdateItem(doValidation );
FormView2.UpdateItem(doValidation );
FormView3.UpdateItem(doValidation );
FormView4.UdpateItem(doValidation );
}
0
 

Author Comment

by:allanmark
ID: 24394791
Tks!

Applied your suggestion. What happens is that the data for the first formview is saved, but for those following it is not
<asp:LinkButton ID="lnkbtnUpdateAll_AE" runat="server" OnClick="ButtonUpdateAll_Click">Update all details</asp:LinkButton>
 

protected void ButtonUpdateAll_Click(object sender, EventArgs e)

    {

        bool doValidation = true;

     

        fvAddress.UpdateItem(doValidation);
 

        fvSpousal.UpdateItem(doValidation);

    }

Open in new window

0
 

Author Comment

by:allanmark
ID: 24394799
...sorry .. hit the wrong button ...


Is there anything else that I need to be doing?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:allanmark
ID: 24394981
.. not sure if this has any bearing on the issue ...

If the update commands are swopped around, so that the last formview (in order that they appear on the page) is updated first, and then the first formview is updated   --  this works?
0
 

Author Comment

by:allanmark
ID: 24431441
SORRY ... it was a stupid mistake on my part!!

Works 100%!
0
 

Author Closing Comment

by:allanmark
ID: 31581538
Many thanks!!
0
 
LVL 8

Expert Comment

by:ppittle
ID: 24431602
Glad to see everything worked out =)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

14 Experts available now in Live!

Get 1:1 Help Now