Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 10th, 2012, 09:12 AM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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;
}
}
Reply With Quote
  #2 (permalink)  
Old February 10th, 2012, 09:20 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old February 10th, 2012, 09:30 AM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #4 (permalink)  
Old February 10th, 2012, 09:49 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #5 (permalink)  
Old February 10th, 2012, 09:54 AM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
Reply With Quote
  #6 (permalink)  
Old February 11th, 2012, 05:00 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SMS API does not work online but work fine offline. Tonik Beginning PHP 1 January 4th, 2013 08:30 AM
Why does this code work (chp.6)? wrockinator BOOK: Ivor Horton's Beginning Visual C++ 2008 ISBN: 978-0-470-22590-5 3 December 3rd, 2008 03:16 AM
Values in Containers DoubleDiamond007 C# 2005 1 March 25th, 2008 04:44 PM
Placing controls in containers at run time. HotBlue VB How-To 2 October 13th, 2006 05:58 PM



All times are GMT -4. The time now is 12:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.