C#服务器端获取客户端(html)控件值
生活随笔
收集整理的這篇文章主要介紹了
C#服务器端获取客户端(html)控件值
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
方法1:
C#
Label1.Text = Request.Form["txtName"].ToString();
vb.net
Request.Form("txtName").ToString()
方法2:
C#
System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(Request.Form);Label1.Text = nc.GetValues("txtName")[0].ToString();
注: "txtName"為Html控件的"name"屬性值
以上代碼在Microsoft Visual Studio 2008下調試通過
C#
Label1.Text = Request.Form["txtName"].ToString();
vb.net
Request.Form("txtName").ToString()
方法2:
C#
System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(Request.Form);Label1.Text = nc.GetValues("txtName")[0].ToString();
注: "txtName"為Html控件的"name"屬性值
以上代碼在Microsoft Visual Studio 2008下調試通過
總結
以上是生活随笔為你收集整理的C#服务器端获取客户端(html)控件值的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 至尊借款是什么平台
- 下一篇: C#中NameValueCollecti