静态页面提交到A.aspx<!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>
<title>无标题页</title>
</head>
<body>
<form action="NewsComment.aspx" method="post">
<textarea rows="10" cols="40" id="Content"> </textarea>
<input id="Button1" type="submit" value="提交" /><br />
</form>
</body>
</html>A.aspx的CS代码
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Request.Form["Content"]);
}
请问为什么获取不了值呢?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无标题页</title>
</head>
<body>
<form action="NewsComment.aspx" method="post">
<textarea rows="10" cols="40" id="Content"> </textarea>
<input id="Button1" type="submit" value="提交" /><br />
</form>
</body>
</html>A.aspx的CS代码
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Request.Form["Content"]);
}
请问为什么获取不了值呢?
在ASP页面是可以
你提交到的是NewsComment.aspx啊,跟A.aspx有什么关系?
<textarea rows="10" cols="40" id="Content"> </textarea>
<input id="Button1" type="submit" value="提交" /><br />
</form>
改成这样试试
<form action="NewsComment.aspx" method="post" runat="server">
<textarea rows="10" cols="40" id="Content"> </textarea>
<input id="Button1" type="submit" value="提交" runat="server"><br />
</form>
的id name属性没有啊
<form name="frm1" id="frm1" action="NewsComment.aspx" method="post">