【ADO.NET基础】后台获取前台控件

时间:2023-03-09 19:51:24
【ADO.NET基础】后台获取前台控件

C# 后台获取前台 input 文本框值.
string aa=Request.Form[headself];

那么要是后台给前台input文本框赋值呢?

后台 public string Headself=null;
Headself="123";
前台
<%=Headself%>
也可以把input改为服务器控件,
<intpu type='textbox' runat='server'>
另一种用ajax 取值,用javascirpt给客户端控件input赋值

例一:纯客户端控件

<input name="edisundong" type="text"> 在服务器端取得的方法

string strvalue=Request.Form.Get("edisundong"); 例二:纯客户端控件

<input type="radio" name="sex" value="1" checked="true" /> <input type="radio" name="sex" value="2" />

string[] strvlaues=Request.Form.GetValues("sex");