本人按照msdn (http://msdn.microsoft.com/zh-cn/library/wdb4eb30(VS.80).aspx#Y1800)上的方法测试wizard,调试不成功
编译器错误信息: CS0103: 当前上下文中不存在名称“Label1”。
一下是代码:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!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:Wizard ID="Wizard1" runat="server" ActiveStepIndex="2" Height="112px" OnFinishButtonClick="Wizard1_FinishButtonClick" Width="416px">
  <WizardSteps>
  <asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1">
  名称:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
  </asp:WizardStep>
  <asp:WizardStep ID="WizardStep2" runat="server" Title="Step 2">
  电子邮件:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
  </asp:WizardStep>
  <asp:TemplatedWizardStep ID="已完成" runat="server" StepType="Finish">
  <ContentTemplate>
  <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
  <br />
  <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
  </ContentTemplate>
  </asp:TemplatedWizardStep>
  </WizardSteps>
  </asp:Wizard>
  </div>
  </form>
</body>
</html>
后台
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class _Default : System.Web.UI.Page  
{
  void Page_Load(Object sender, System.EventArgs e)
  {
  Label1.Text = TextBox1.Text;
  Label2.Text = TextBox2.Text;
  }
}

解决方案 »

  1.   

    Label1放在了TemplatedWizardStep里面,ID变了。你看下html的代码,看一下Label的ID是不是变了。
      

  2.   

    用 WizardStep1.FindControls 查找吧
      

  3.   

    按照msdn上的步骤完成,并没有报错,如下代码:
    <form id="form1" runat="server">
            <asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0" Height="254px" Width="554px">
                <WizardSteps>
                    <asp:WizardStep runat="server" Title="Step 1">
                        名称<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    </asp:WizardStep>
                    <asp:WizardStep runat="server" Title="Step 2">
                        电子邮件:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                    </asp:WizardStep>
                    <asp:WizardStep runat="server" StepType="Complete" Title="已完成">
                        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                        <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
                    </asp:WizardStep>
                </WizardSteps>
            </asp:Wizard>
        </form>
      

  4.   


    帮你改好啦
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!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 id="Head1" runat="server">
      <title>无标题页</title>
    </head>
    <body>
      <form id="form1" runat="server">
      <div>
      <asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="2" Height="112px" 
               Width="416px">
          <StartNavigationTemplate>
              <asp:Button ID="StartNextButton" runat="server" CommandName="MoveNext" 
                  Text="下一步" />
          </StartNavigationTemplate>
      <WizardSteps>
      <asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1">
      名称:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
      </asp:WizardStep>
      <asp:WizardStep ID="WizardStep2" runat="server" Title="Step 2">
      电子邮件:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
      </asp:WizardStep>
     <asp:WizardStep ID="WizardStep3" runat="server" Title="Step 3">
         <asp:Label ID="Label1" runat="server" Text="test1" ></asp:Label>
         <asp:Label ID="Label2" runat="server" Text="test1"></asp:Label>
      </asp:WizardStep>
      </WizardSteps>
          <FinishNavigationTemplate>
              <asp:Button ID="FinishPreviousButton" runat="server" CausesValidation="False" 
                  CommandName="MovePrevious" Text="上一步" />
              <asp:Button ID="FinishButton" runat="server" CommandName="MoveComplete" 
                  Text="完成" />
          </FinishNavigationTemplate>
      </asp:Wizard>
      </div>
      </form>
    </body>
    </html>
      

  5.   

    出现这种问题的原因一般是类的partial 部分没有声明这个控件,vs2008以后的版本可以到YouPage.aspx.designer.cs中看一下有没有声明Label1的语句。