All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
PHP程序加速探索之脚本执行速度测试_php资料_编程技术
Delphi append过程在文件的最后追加文本内容
正则表达式限制文本框只能输入数字,小数点,英文字母,汉字
HTML教程-收集的常用的HTML标签(5)_[Html教程]
C#教程:MouseMove事件使用实例
WEB开发源代码:PHP生成静态页面的类_[PHP教程]
如何自动发布MS,SQL,SERVER数据库_[SQL,Server教程]
ASP.NET,MVC+LINQ开发一个图书销售站点(2)-对象及其关系_[Asp.Net教程]
十七 翻新标准_[Html教程]
GridView列数字、货币和日期的显示格式_[Asp.Net教程]
Reading number is top 10 pictures
29 the belle stars after bath figure5
The most popular girls welcome eggplant
遇到插队的怎么办?
移民小国也实惠1
人美胸美腿更美4
关于海盗的研究2
Sell the barbecue as says father du breul2
在加油站厕所门口看到的告示
Most cow mistress ZhaoGongXia face exposure
A letter to parents choose world of warcraft seven big reason
Download software ranking
JSP+Ajax Web development typical examples
Popkart Cracked versions Mobile phone games
Love the forty days
Such love down(擒爱记)
VC++6.0简体中文版
Unix video tutorial7
c#程序设计案例教程
Unix video tutorial14
C#高级编程(第4版)
jdk1.5
归海一刀 published in(发表于) 2014/1/30 1:17:27 Edit(编辑)
asp.net,后台代码如何遍历checkbox_[Asp.Net教程]

asp.net,后台代码如何遍历checkbox_[Asp.Net教程]

asp.net 后台代码如何遍历checkbox_[Asp.Net教程]
aspx设计页面
//这个是检测按钮,检测下面的checkbox是否被选中。选中时打印其值

第一种设计:(.net 自带的)




第二种设计:(html 自带的,但含有runnat="server")


第三种设计:(html 自带的)


aspx.cs文件 (将按照对应的上面的三种设计模式去写后台代码。其他的单选按钮也类似。)
protected void Button1_Click(object sender, EventArgs e)
{
//这个是上面第一种模式
foreach (Control ct in form1.Controls)
{
if (ct.GetType().ToString().Equals("System.Web.UI.WebControls.CheckBox"))
{
CheckBox cb = (CheckBox)ct;
if (cb.Checked == true)
{
Response.Write(cb.Text);
}
}
}
//这个是上面第二种模式。(直接用request取值,会报错的。不信试试)
foreach (Control ct in form1.Controls)
{
if (ct.GetType().ToString().Equals("System.Web.UI.HtmlControls.HtmlInputCheckBox"))
{
HtmlInputCheckBox cb = (HtmlInputCheckBox)ct;
if (cb.Checked == true)
{
Response.Write(cb.Value);
}
}
}
//这个是上面第三种模式。(没有runnat="server",用request取值 最简单)
Response.Write(Request["aa"].ToString());
}


添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.