首页 新闻 会员 周边

aspx页面获得静态页面的form表单的数据

1
悬赏园豆:20 [已解决问题] 解决于 2012-02-17 17:36

<form action="registerdo.aspx" method="post">
  <table border="1">
  <tr>
  <td>
  用户名:
  </td>
  <td>
  <input id="uname" type="text" onblur="check(this.value)" /><div style="display: inline"
  id="unamediv">
  </div>
  </td>
  </tr>
  <tr>
  <td>
  密码:
  </td>
  <td>
  <input id="upass" type="password" />
  <div style="display: inline">
  </div>
  </td>
  </tr>
  <tr>
  <td colspan="2">
  <input id="Button1" type="button" value="注册" onclick="register()"/>
  </td>
  </tr>
  </table>
  </form>

这是一个普通的静态页面中的一段代码,大体意思能看明白吧,重点是Form的那个Action的值,这个静态页面的Form表单所提交的路径是个aspx页面,我想请教各位大哥,怎样能在那个aspx页面获得值呢

穆之霞的主页 穆之霞 | 初学一级 | 园豆:197
提问于:2012-02-17 00:53
< >
分享
最佳答案
1

用Request.Form

但你的表单要修改一下,用Request.Form是按元素的name取值的,例如:

<input id="uname" name="uname" type="text" onblur="check(this.value)"/>

上面的用:

string uname = Request.Form["uname"];

参考:http://www.cnblogs.com/fish-li/archive/2011/07/17/2108884.html

收获园豆:20
artwl | 专家六级 |园豆:16736 | 2012-02-17 09:06

才疏学浅,多谢赐教

穆之霞 | 园豆:197 (初学一级) | 2012-02-17 17:35
其他回答(1)
0

request.Form(控件名)就行了

架构师修行之路 | 园豆:322 (菜鸟二级) | 2012-02-17 17:20
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册