日期:2014-05-20  浏览次数:20393 次

页面传值没起作用的小问题
我有两个页面,a.htm,b.aspx.在a.htm上有两textBox(txtuserName,txtUserPwd)和一button,现我想点提交button时,在b.aspx上结收userName和userPwd,
代码如下:
string   UserName   =   Request[ "txtUserName "]   !=   null   ?   Request[ "txtUserName "].ToString()   :   string.Empty;
string   UserPwd   =   Request[ "txtUserPwd "]   !=   null   ?   Request[ "txtUserPwd "].ToString()   :   string.Empty;

Response.Write( "用户名是: "   +   UserName   +   " <br> 密码是: "   +   UserPwd);
为什么当我提交的时候,什么都得不到呢?也就是得不到userName和UserPwd的值.(用post方式提交)
(不管我在a.htm的textbox上有没有输入值,得到的都是nothing,另,是在vs2005中,我在2003中是可以做到的,为什么会这样子啊?刚用05不久)

------解决方案--------------------
<input id= "txtUserName " type= "text " /> => <input id= "txtUserName " name= "txtUserName " type= "text " />

<input id= "txtUserPwd " type= "text " /> => <input id= "txtUserPwd " name= "txtUserPwd " type= "text " />