我在PostTest1.aspx里面的代码如下:
html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" method="post" action="FormTest1.aspx">
<input type="text" id="txt_user" />
<input type="text" id="txt_password" />
<input type="submit" value="提交" />
</form>
</body>
</html>在FormTest1.aspx.cs里面的代码如下:
if (Request.Form["txt_user"] != null)
{
string User_Name = Request.Form["txt_user"].ToString();
Response.Write(User_Name.ToString());
}
else
{
Response.Write("111");
}
if (Request.Form["txt_password"] != null)
{
string User_Password = Request.Form["txt_password"].ToString();
Response.Write(User_Password.ToString());
}
else
{
Response.Write("222");
}
输出的结果是111222,说明取出来的值是空的,我哪里出错了啊,请高手赐教
html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" method="post" action="FormTest1.aspx">
<input type="text" id="txt_user" />
<input type="text" id="txt_password" />
<input type="submit" value="提交" />
</form>
</body>
</html>在FormTest1.aspx.cs里面的代码如下:
if (Request.Form["txt_user"] != null)
{
string User_Name = Request.Form["txt_user"].ToString();
Response.Write(User_Name.ToString());
}
else
{
Response.Write("111");
}
if (Request.Form["txt_password"] != null)
{
string User_Password = Request.Form["txt_password"].ToString();
Response.Write(User_Password.ToString());
}
else
{
Response.Write("222");
}
输出的结果是111222,说明取出来的值是空的,我哪里出错了啊,请高手赐教
给标签些name=id值就好了