您的位置:首页 > 编程语言 > ASP

[Asp.Net]asp.net后台获取前台html控件的值的方法

2011-04-16 14:27 781 查看
asp.net后台获取前台html控件的值的方法

Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/
-protected void Button1_Click(object sender, EventArgs e)
{

System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection (Request.Form);

Response.Write(nc.GetValues("txtname")[0].ToString());
} 此方法只能对<input type="text" />等类型的控件数据进行获取,对于select控件,如果value和text不一样,只能获取value。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: