• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

Execute Update on multiple FormViews

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
allanmark
Asked:
allanmark
  • 5
  • 2
1 Solution
 
ppittleCommented:
<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
 
allanmarkAuthor Commented:
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
 
allanmarkAuthor Commented:
...sorry .. hit the wrong button ...


Is there anything else that I need to be doing?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
allanmarkAuthor Commented:
.. 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
 
allanmarkAuthor Commented:
SORRY ... it was a stupid mistake on my part!!

Works 100%!
0
 
allanmarkAuthor Commented:
Many thanks!!
0
 
ppittleCommented:
Glad to see everything worked out =)
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now