
我的这个提交怎么不显示用户名和密码?急啊 ! 20
publicpartialclass_Default:System.Web.UI.Page{protectedvoidPage_Load(objectsender,Eve...
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ {
string username = Request["txtusername.Text"] != null ? Request["txtusername.Text"].ToString() : "";
string userpwd = Request["txtuserpwd.Text"] != null ? Request["txtuserpwd.Text"].ToString() : "";
Response.Write("登录的用户名为" + username + ";密码为" + userpwd);
在login.html里 是 <form method="post" action="webform1.aspx"></form> 而 运行之后显示的是
登录的用户名为;密码为 就是出不来用户名和密码。
前两个都试过了。不行啊</script>
</head>
<body>
<form method="post" action="webform1.aspx">
<input id="txtusername" style="z-index: 100; left: 165px; position: absolute; top: 50px"
type="text" />
<input id="txtuserpwd" style="z-index: 101; left: 166px; position: absolute; top: 80px"
type="text" />
<input id="Submit1" style="z-index: 102; left: 168px; position: absolute; top: 112px"
type="submit" value="提交" language="javascript" name="submit" />
</form>
<form method="post" action="webform1.aspx"></form>看这个有错误吗?
加控件也不行啊! 展开
{
protected void Page_Load(object sender, EventArgs e)
{ {
string username = Request["txtusername.Text"] != null ? Request["txtusername.Text"].ToString() : "";
string userpwd = Request["txtuserpwd.Text"] != null ? Request["txtuserpwd.Text"].ToString() : "";
Response.Write("登录的用户名为" + username + ";密码为" + userpwd);
在login.html里 是 <form method="post" action="webform1.aspx"></form> 而 运行之后显示的是
登录的用户名为;密码为 就是出不来用户名和密码。
前两个都试过了。不行啊</script>
</head>
<body>
<form method="post" action="webform1.aspx">
<input id="txtusername" style="z-index: 100; left: 165px; position: absolute; top: 50px"
type="text" />
<input id="txtuserpwd" style="z-index: 101; left: 166px; position: absolute; top: 80px"
type="text" />
<input id="Submit1" style="z-index: 102; left: 168px; position: absolute; top: 112px"
type="submit" value="提交" language="javascript" name="submit" />
</form>
<form method="post" action="webform1.aspx"></form>看这个有错误吗?
加控件也不行啊! 展开
3个回答
展开全部
改为:
string username =txtusername.Text!= null ?txtusername.Text: "";
string userpwd = txtuserpwd.Text != null ?txtuserpwd.Text : "";
string username =txtusername.Text!= null ?txtusername.Text: "";
string userpwd = txtuserpwd.Text != null ?txtuserpwd.Text : "";
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Request["txtusername.Text"] 改成 txtusername.Text的ID名称
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
在页面上加个label控件,将"登录的用户名为" + username + ";密码为" + userpwd给他,看看能显示不?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询