 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

February 10th, 2012, 09:12 AM
|
|
Registered User
|
|
Join Date: Feb 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Can't Get Containers in Chp 4 to work
I've tried to code and copy this example and I'm getting the same error when I change the final WizardStep to StepType="Complete"... If I change the StepType to Auto it "works" but doesn't complete with the buttons being gone. I have previous and finish.
Error:
The command 'MoveComplete' is not valid for the previous step, make sure the step type is not changed between postbacks.
[InvalidOperationException: The command 'MoveComplete' is not valid for the previous step, make sure the step type is not changed between postbacks.]
System.Web.UI.WebControls.Wizard.OnBubbleEvent(Obj ect source, EventArgs e) +1660841
System.Web.UI.WebControls.WizardChildTable.OnBubbl eEvent(Object source, EventArgs args) +19
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e) +125
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +167
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
ASPX Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Containers.aspx.cs" Inherits="Demos_Containers" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged" Text="Show Panel" />
<asp:Panel ID="Panel1" runat="server" Visible="False">
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="2" Width="500px"
onfinishbuttonclick="Wizard1_FinishButtonClick">
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="About You">
<asp:Label ID="Label1" runat="server" Text="Type your name"></asp:Label>
<asp:TextBox ID="YourName" runat="server"></asp:TextBox>
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2" runat="server" Title="Favorite Language" StepType="Finish">
<asp:DropDownList ID="FavoriteLanguage" runat="server">
<asp:ListItem>C#</asp:ListItem>
<asp:ListItem>Visual Basic</asp:ListItem>
<asp:ListItem>CSS</asp:ListItem>
</asp:DropDownList>
</asp:WizardStep>
<asp:WizardStep ID="WizardStep3" runat="server" StepType="Complete" Title="Ready">
<asp:Label ID="Result" runat="server" Text="Label"></asp:Label>
</asp:WizardStep>
</WizardSteps>
</asp:Wizard>
</asp:Panel>
</div>
</form>
</body>
</html>
Code Behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Demos_Containers : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
Panel1.Visible = CheckBox1.Checked;
}
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
Result.Text = "Your name is: " + YourName.Text;
Result.Text +="<br/>Your favorite language is: " + FavoriteLanguage.SelectedValue;
}
}
|
|

February 10th, 2012, 09:20 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
This code works fine for me if I change ActiveStepIndex="2" to ActiveStepIndex="0" (otherwise you won't see the Wizard at all).
Are you sure this is all your code?
Imar
|
|

February 10th, 2012, 09:30 AM
|
|
Registered User
|
|
Join Date: Feb 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Still doesn't work
Thanks for the quick reply.
I've changed ActiveStepIndex to 0 and now it does display in MVS but I'm still getting the same error when I run it. I have cleared my cache just in case it was lingering...
Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Containers.aspx.cs" Inherits="Demos_Containers" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged" Text="Show Panel" />
<asp:Panel ID="Panel1" runat="server" Visible="False">
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0" Width="500px" onfinishbuttonclick="Wizard1_FinishButtonClick">
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="About You">
<asp:Label ID="Label1" runat="server" Text="Type your name"></asp:Label>
<asp:TextBox ID="YourName" runat="server"></asp:TextBox>
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2" runat="server" Title="Favorite Language" StepType="Finish">
<asp:DropDownList ID="FavoriteLanguage" runat="server">
<asp:ListItem>C#</asp:ListItem>
<asp:ListItem>Visual Basic</asp:ListItem>
<asp:ListItem>CSS</asp:ListItem>
</asp:DropDownList>
</asp:WizardStep>
<asp:WizardStep ID="WizardStep3" runat="server" StepType="Complete" Title="Ready">
<asp:Label ID="Result" runat="server" Text="Label"></asp:Label>
</asp:WizardStep>
</WizardSteps>
</asp:Wizard>
</asp:Panel>
</div>
</form>
</body>
</html>
Resulting Page:
The command 'MoveComplete' is not valid for the previous step, make sure the step type is not changed between postbacks.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The command 'MoveComplete' is not valid for the previous step, make sure the step type is not changed between postbacks.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: The command 'MoveComplete' is not valid for the previous step, make sure the step type is not changed between postbacks.]
System.Web.UI.WebControls.Wizard.OnBubbleEvent(Obj ect source, EventArgs e) +1660841
System.Web.UI.WebControls.WizardChildTable.OnBubbl eEvent(Object source, EventArgs args) +19
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e) +125
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +167
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
|
|

February 10th, 2012, 09:49 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
That's odd. Here's what I tried:
1. In VS 2010, choose File | New Web Site
2. Created a Demos folder
3. Added a Containers web form to the folder
4. Copied your markup to the ASPX and changed the step index
5. Copied your code to the aspx.cs file
6. Saved all changes
7. Hit F5 to run the page in the brower.
All works fine, so maybe there's other code in your site messing things up?
Imar
|
|

February 10th, 2012, 09:54 AM
|
|
Registered User
|
|
Join Date: Feb 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
maybe not code but setup?
Am I missing something in the setup of IIS or MVS 2010?
I really like this feature and see great use for it so I want to make sure I understand it, it is working and I can test it in my dev environemnt.
|
|

February 11th, 2012, 05:00 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
Am I missing something in the setup of IIS or MVS 2010?
|
I doubt that would be the case. Not sure though as I've never seen this error.
Did you try my steps by creating a new site? Does it work then?
Imar
|
|
 |
|