首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

页面传值没起作用的小疑点

2012-01-05 
页面传值没起作用的小问题我有两个页面,a.htm,b.aspx.在a.htm上有两textBox(txtuserName,txtUserPwd)和一b

页面传值没起作用的小问题
我有两个页面,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 " />

热点排行