andyherebi 0 Newbie Poster

Hi Guys. I have a problem with my code, It should work as an membership creator, and has 4 steps, 3 steps are in multiview1, and the 4th steep is to show the message, "Your Account has been successfully created" which is on multiview2. The buttons are "back", "next" and "confirm". The problem is that when 4th step appears the buttons should not appear. This needs to be used only as an simulation, doesn't need to send the forms data to anywhere.

Will appreciate your help

<asp:MultiView ID="MultiView1" runat="server" 
            onactiveviewchanged="MultiView1_ActiveViewChanged">
            <asp:View ID="View1" runat="server">
                Step 1
            </asp:View>
            <asp:View ID="View2" runat="server">
                Step 2
            </asp:View>
            <asp:View ID="View3" runat="server">
                Step 3
            </asp:View>
        </asp:MultiView>
        <br />

		<asp:Button ID="btnBack" runat="server" Text="&lt; Back " OnClick="btnBack_Click" />
		<asp:Button ID="btnNext" runat="server" Text="Next &gt;" OnClick="btnNext_Click" />	
		<asp:Button ID="btnSend" runat="server" Text="Confirm" OnClick="btnSend_Click" />
		
	</div>
	<asp:MultiView ID="MultiView2" runat="server">
        <asp:View ID="View4" runat="server">
           Step 4  - Your Account has been successfully created
        </asp:View>
    </asp:MultiView>

and the code behind is as follow

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    { }

    protected void btnBack_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex--;
    }

    protected void btnNext_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex++;
    }

    protected void btnSend_Click(object sender, EventArgs e)
    {
        MultiView2.ActiveViewIndex++;
        MultiView2.Visible = true;
        MultiView1.Visible = false;
    }

    protected override void OnPreRender(EventArgs e)
    {
        btnBack.Visible = MultiView1.ActiveViewIndex > 0;
        btnNext.Visible = MultiView1.ActiveViewIndex < MultiView1.Views.Count - 1;
        btnSend.Visible = MultiView1.ActiveViewIndex == MultiView1.Views.Count - 1;
        base.OnPreRender(e);
        MultiView2.Visible = true;
    }

    protected void MultiView1_ActiveViewChanged(object sender, EventArgs e)
    {

    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.