本人按照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;
}
}
编译器错误信息: 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;
}
}
<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>
帮你改好啦
<%@ 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>