zl程序教程

您现在的位置是:首页 >  后端

当前栏目

.net后台获取html控件值的2种方法

Net后台方法HTML 获取 控件
2023-06-13 09:14:50 时间
方法1:  
C#
  Label1.Text=Request.Form["txtName"].ToString();
  vb.net
  Request.Form("txtName").ToString()
方法2:
C#
  System.Collections.Specialized.NameValueCollectionnc=newSystem.Collections.Specialized.NameValueCollection(Request.Form);Label1.Text=nc.GetValues("txtName")[0].ToString();
  注:"txtName"为Html控件的"name"属性值
  以上代码在MicrosoftVisualStudio2012下调试通过