Multiview and Buttons

Please support our ASP.NET advertiser: $6.99 Domain Names at 1&1. Includes Free Privacy. Save Now!
Reply

Join Date: Nov 2009
Posts: 9
Reputation: andyherebi is an unknown quantity at this point 
Solved Threads: 0
andyherebi andyherebi is offline Offline
Newbie Poster

Multiview and Buttons

 
0
  #1
Nov 19th, 2009
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

  1. <asp:MultiView ID="MultiView1" runat="server"
  2. onactiveviewchanged="MultiView1_ActiveViewChanged">
  3. <asp:View ID="View1" runat="server">
  4. Step 1
  5. </asp:View>
  6. <asp:View ID="View2" runat="server">
  7. Step 2
  8. </asp:View>
  9. <asp:View ID="View3" runat="server">
  10. Step 3
  11. </asp:View>
  12. </asp:MultiView>
  13. <br />
  14.  
  15. <asp:Button ID="btnBack" runat="server" Text="&lt; Back " OnClick="btnBack_Click" />
  16. <asp:Button ID="btnNext" runat="server" Text="Next &gt;" OnClick="btnNext_Click" />
  17. <asp:Button ID="btnSend" runat="server" Text="Confirm" OnClick="btnSend_Click" />
  18.  
  19. </div>
  20. <asp:MultiView ID="MultiView2" runat="server">
  21. <asp:View ID="View4" runat="server">
  22. Step 4 - Your Account has been successfully created
  23. </asp:View>
  24. </asp:MultiView>

and the code behind is as follow

  1. using System;
  2. using System.Web;
  3. using System.Web.UI;
  4. using System.Web.UI.WebControls;
  5. using System.Web.UI.HtmlControls;
  6.  
  7. public partial class _Default : System.Web.UI.Page
  8. {
  9. protected void Page_Load(object sender, EventArgs e)
  10. { }
  11.  
  12. protected void btnBack_Click(object sender, EventArgs e)
  13. {
  14. MultiView1.ActiveViewIndex--;
  15. }
  16.  
  17. protected void btnNext_Click(object sender, EventArgs e)
  18. {
  19. MultiView1.ActiveViewIndex++;
  20. }
  21.  
  22. protected void btnSend_Click(object sender, EventArgs e)
  23. {
  24. MultiView2.ActiveViewIndex++;
  25. MultiView2.Visible = true;
  26. MultiView1.Visible = false;
  27. }
  28.  
  29. protected override void OnPreRender(EventArgs e)
  30. {
  31. btnBack.Visible = MultiView1.ActiveViewIndex > 0;
  32. btnNext.Visible = MultiView1.ActiveViewIndex < MultiView1.Views.Count - 1;
  33. btnSend.Visible = MultiView1.ActiveViewIndex == MultiView1.Views.Count - 1;
  34. base.OnPreRender(e);
  35. MultiView2.Visible = true;
  36. }
  37.  
  38. protected void MultiView1_ActiveViewChanged(object sender, EventArgs e)
  39. {
  40.  
  41. }
  42. }
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 558 | Replies: 0
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC