概述: 想在后台cs页面得到前台页面aspx中html控件input输入的值. 解决方法如下: 1.用Request["name"].toString();. 前台代码如下: 用户名:<inputname="username"type="text"> 后台获取代码如下(记住:一定要是name的值,不是id的值): string username = Request[ " username " ].ToString(); 2.用Request.Form.Get("name").ToString(); 前台代码如上一样. 后台获取代码如下:
3.用Request["name"]; 前台代码如上一样。 后台获取代码如下: code string usrname=Request["name"]; 注:在前台获取html的值: 方法:document.all.("你的控件的id").value; 例如:下面实现了在页面中搜索的功能 <input id="t1" type="text" /> <input id="Button1" οnclick="findInPage(document.all.t1.value)" <script language="javascript"> 这样就可以实现在页面中来搜索内容了。呵呵 |
在cs后台页面获取input的值方法
最新推荐文章于 2023-05-28 13:25:11 发布