Solved

Execute Update on multiple FormViews

Posted on 2009-05-14
7
365 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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