http://blog.youkuaiyun.com/lllxy/article/details/2253337
在asp.net的**.aspx的源文件中,使用一个 html端的控件的方法如下:
<body >
<form id="form1" runat="server">
<input id="Text2" type="text" value = "" />
</form>
</body>
在**.aspx的设计界面,选中该文本框,点击右键,执行: 作为服务器控件运行,那么脚本代码变为:
<input id="Text2" type="text" value = "" runat="server" />
那么我们可以在服务器端执行使用如下代码来访问html控件的值.
string value = Text2.Value ;//Text2是html控件的id
--------------------------------------------------------------------------------------------------------------------------------------------------------
http://blog.163.com/zhangxinxiao_zxx/blog/static/11197621520097214249125/
asp.net 页面中 的html控件 在页面后台中无法获取值
解决方法有两种 :
第一种办法 :
在页面控件处添加 runat="server";使之变成服务器控件。
第二种办法 :
用request.form
第一: 前台页面代码 中
<input type="text" id="text1" name="text1" /> 一定要有name属性 否则取不出值 。
第二:后台 .cs文件中
string aa= Request.Form.Get("text1");
或者 string aa=Request.Form["text1"];