multiple form submits using updatepanels in

Posted on 2008-11-17
Last Modified: 2012-05-05
Can someone please give me some help with using updatepanels in I currently have an form, which has 2 main sections. Previously, each section was its own form on its own separate page. I want both sections on the same page, with the second hidden from view until the first one is completed.

In the code snippet, you'll see that I have an update panel currently surrounding the first section of the form. When the submit button is hit, I want to save all the fields in hidden fields or variables (or whatever is the best practice) and hide its visibility, then make the second form visible in the same screen space. On submitting the second form, thats when I perform my query to the database and move off the page. The backend of the pages is in C#.
<div id="formContent">

<asp:UpdatePanel ID="upRegStep1" runat="server">


    <table border="0" cellspacing="5" cellpadding="5" width="900px">


            <th>New User</th>




            <td><asp:TextBox ID="txtUsername" runat="server" /></td>


            <td><asp:TextBox ID="txtPassword" runat="server" TextMode="Password" /></td>



            <td><b>First Name:</b></td>

            <td><asp:TextBox ID="txtFirstName" runat="server" /></td>

            <td><b>Password Confirm:</b></td>

            <td><asp:TextBox ID="txtPasswordConfirm" runat="server" TextMode="Password" /></td>



            <td colspan="4"><asp:Button ID="btnSubmitStep1" runat="server" Text="Next Step" 

                    onclick="btnSubmitStep1_Click" /></td>





<table border="0" cellspacing="5" cellpadding="5" width="900px">


            <th>More Information</th>



            <td><b>Marital Status:</b></td>

            <td><asp:DropDownList ID="ddlMarital" runat="server">

            <asp:ListItem Value="Single">Single</asp:ListItem>

            <asp:ListItem Value="Married">Married</asp:ListItem>

            <asp:ListItem Value="Divorced">Divorced</asp:ListItem>


            <td><b>Yearly Income:</b></td>

            <td><asp:DropDownList ID="ddlYearlyIncome" runat="server">

            <asp:ListItem Value="020k">$0 - $20,000</asp:ListItem>

            <asp:ListItem Value="2050k">$20,000 - $50,000</asp:ListItem>

            <asp:ListItem Value="50100k">$50,000 - $100,000</asp:ListItem>

            <asp:ListItem Value="100k+">$100,000 +</asp:ListItem>




            <td colspan="4"><asp:Button ID="btnSubmitStep2" runat="server" Text="Create Profile" 

                    onclick="btnSubmitStep2_Click" /></td>




Open in new window

Question by:nuvium
    LVL 8

    Accepted Solution

    I would just wrap your part1 in a div and call a javascript function to hide that div and display the second part of your form. Then use your  to handle the actual submit of your form.

    <script language="javascript">
        function goToPart2() {
            document.getElementById("formPart1").style.display = "none";
            document.getElementById("formPart2").style.display = "block";

    then your just call .... onclick="javascript:goToPart2();" />

    from your btnSubmitStep1 but instead of using the asp:button, just use a standard <input type="button" ... and then use the asp:button for your actual submit to commit the data.

    LVL 2

    Assisted Solution

    The other easy option is to place the contents of each part in asp:panels and make visible to false or true depending on user actions.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    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…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    728 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

    19 Experts available now in Live!

    Get 1:1 Help Now