初学,简单,帮我看看为什么出错 <form action="holidayresponse.aspx" method="post">改成<form id="form1" method="post" runat="server">服务器端控件必须放在具有 runat=server 的窗体标记内。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 加了runat="server"之后,按submit不能跳转到holidayresponse.aspx了,怎么办?必须要跳到holidayresponse.aspx才行 you must add "runat=server" into "<form>" 用transfer,请参考下面的列子://////////////////////////////////////////////firstpage.aspx//////////////////////////////////////////////<%@ Page Language="C#" Inherits="FirstPageClass" %><html><head></head><body> <form runat="server"> First Name: <asp:TextBox id="first" runat="server"/> <br/> Last Name: <asp:TextBox id="last" runat="server"/> <br/> <asp:Button id="Button1" OnClick="ButtonClicked" Text="Go to second page" runat=server /> </form></body></html>//////////////////////////////////////////////////firstpage.aspx.cs//////////////////////////////////////////////using System;public class FirstPageClass : System.Web.UI.Page{ protected System.Web.UI.WebControls.TextBox first; protected System.Web.UI.WebControls.TextBox last; protected System.Web.UI.WebControls.Button Button1; public string FirstName { get { return first.Text; } } public string LastName { get { return last.Text; } } void ButtonClicked(object sender, EventArgs e) { Server.Transfer("secondpage.aspx"); }}//////////////////////////////////////////////////secondpage.aspx//////////////////////////////////////////////////<%@ Page Language="C#" Inherits="SecondPageClass" %><%@ Reference Page="firstpage.aspx" %><html><head></head> <body> <form runat="server"> Hello <%=fp.FirstName%> <%=fp.LastName%> </form></body></html>//////////////////////////////////////////////////secondpage.aspx.cs//////////////////////////////////////////////////using System;public class SecondPageClass : System.Web.UI.Page{ protected System.Web.UI.WebControls.Label DisplayLabel; public FirstPageClass fp; void Page_Load() { if (!IsPostBack) { fp = (FirstPageClass) Context.Handler; } }} 在网上看见的一个 分页存储过程 怎么调用啊? AJAX局部刷新的问题 我想要一个纯净的局部页面 如何遍历26个字母 到想要的字母,得知字母D,就自动遍历出A、B、C、D,有示例代码 document.form1.elements为空或不是对象 ASP.NET实现论坛,毕业设计相关问题。 VS2005+nhibernate入门问题 treeview请高手帮忙 datagrid的小问题 asp.net如何读取IFrame中的form 麻烦大家帮我分析一段小的代码 不超过100个任意字的正规表达式怎么写?
必须要跳到holidayresponse.aspx才行
firstpage.aspx
//////////////////////////////////////////////
<%@ Page Language="C#" Inherits="FirstPageClass" %><html>
<head></head><body> <form runat="server">
First Name:
<asp:TextBox id="first"
runat="server"/>
<br/>
Last Name:
<asp:TextBox id="last"
runat="server"/>
<br/>
<asp:Button
id="Button1"
OnClick="ButtonClicked"
Text="Go to second page"
runat=server />
</form></body></html>
//////////////////////////////////////////////////
firstpage.aspx.cs
//////////////////////////////////////////////
using System;public class FirstPageClass : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox first;
protected System.Web.UI.WebControls.TextBox last;
protected System.Web.UI.WebControls.Button Button1; public string FirstName
{
get
{
return first.Text;
}
} public string LastName
{
get
{
return last.Text;
}
} void ButtonClicked(object sender, EventArgs e)
{
Server.Transfer("secondpage.aspx");
}
}//////////////////////////////////////////////////
secondpage.aspx
//////////////////////////////////////////////////
<%@ Page Language="C#" Inherits="SecondPageClass" %>
<%@ Reference Page="firstpage.aspx" %><html><head></head> <body> <form runat="server"> Hello <%=fp.FirstName%> <%=fp.LastName%> </form></body></html>
//////////////////////////////////////////////////
secondpage.aspx.cs
//////////////////////////////////////////////////
using System;public class SecondPageClass : System.Web.UI.Page
{ protected System.Web.UI.WebControls.Label DisplayLabel;
public FirstPageClass fp; void Page_Load()
{
if (!IsPostBack)
{
fp = (FirstPageClass) Context.Handler;
}
}}