Solved

Execute Update on multiple FormViews

Posted on 2009-05-14
7
364 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

825 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