.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下调试通过

以上就是.net后台获取html控件值的2种方法的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » 其他教程