user673906
user673906

Reputation: 847

ASP.net C#. Multiple pages in one

So I am using ASP.NET 4.5 web forms. I have this form where I want a user to enter data, after the users enters data they should be able to press the next button and they can enter more data.

Is it possible to do this on one ASPX form, or do I need to create another ASPX form.

e.g

Username

Password

--- User clicks the next button---

Email

Phone

--- User clicks finish ---

Upvotes: 2

Views: 4246

Answers (4)

user4656905
user4656905

Reputation:

Create two divs, one for username and pwd and another for email and phone.

Using jquery 'hide' and 'show' effects you can control both divs, set 'show' for when user click next button.

I am not sure whether this is a right solution for you.

Upvotes: 2

farrukh aziz
farrukh aziz

Reputation: 172

you can do it in one page. Just add two other textboxes and set visible false to them.when you press next button change the label text and set visible true to these textbox and hide username and password text box.

Upvotes: 1

User2012384
User2012384

Reputation: 4919

Try this:

Initially, I hide the email and phone, when the user clicks next, it set the style to display:block to show the two textboxes

<script>
            function showDiv() {
                document.getElementById('divEmailAndPhone').setAttribute('style', 'display:block');
            }
     </script>
        <form id="form1" runat="server">
            <div>
                <asp:Label runat="server" Text="Username">
                </asp:Label>
                <asp:Label runat="server" Text="Password"></asp:Label>
                <button onclick="showDiv(); return false;">Next</button>
            </div>
            <div id="divEmailAndPhone" style="display:none">
                <asp:Label runat="server" Text="Email"></asp:Label>
                <asp:Label runat="server" Text="Phone"></asp:Label>
            </div>
        </form>

Upvotes: 1

Kiran Varsani
Kiran Varsani

Reputation: 587

Yes this is possible through asp.net Wizard control or MultiView control. You should be able to find these controls in ToolBox under standard category.

To learn more about these controls, please follow these links:

https://msdn.microsoft.com/en-us/library/wdb4eb30(v=vs.140).aspx https://msdn.microsoft.com/en-us/library/ms227665(v=vs.140).aspx

Upvotes: 2

Related Questions