.net后台获取html控件值的2种方法
生活随笔
收集整理的这篇文章主要介绍了
.net后台获取html控件值的2种方法
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
方法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 2012下调试通过
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 2012下调试通过
总结
以上是生活随笔为你收集整理的.net后台获取html控件值的2种方法的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: (easyui datagrid+mvc
- 下一篇: const 和 #define区别