收 藏
投 稿
繁 体
RSS
首 页
运 营
学 院
建 站
论 坛
Web
master8.net
网站运营
欢迎在本站发布信息,在线投递稿件
请点这里
。编辑QQ:4908220,欢迎联系交流。
业界动态
创业故事
推广研究
策划盈利
电子商务
企业平台
站长工具
SEO查询
Whois查询
Pr查询
域名查询
IP查询
网页编辑器
技术学院
投递稿件请点这里:)
网页设计
HTML
XHTML
CSS
Javascript
Frontpage
Dreamweaver
图形图像
PhotoShop
FireWorks
Flash
Coreldraw
程序开发
PHP
ASP
.NET
JSP
CGI
XML
数据库
MySQL
Oracle
MSSQL
Access
综合应用
设计理论
建站系统
服务器管理
常用下载
办公应用
建站服务
如有建站意向,请尽快联系我们,以便安排时间...
QQ:4908220
作品展示
服务范围
服务流程
服务报价
联系方式
付款方式
站长论坛
注册
/
登陆
/
忘密?
交流区
站长酒吧
SEO&推广
网赚交流
建站系统
服务&信息
招聘求职
项目外包
广告发布
网络资源
技术区
网页设计师
界面设计师
WEB程序员
计算机应用
文章正文
» 您的当前位置:
首页
>>
学院
>>
程序开发
>>
ASP.Net
ASP.NET中WebForm组件CheckBoxList编程(4)
来源:
互联网
| 时间:2005-10-04 | 浏览:
相关评论
|
报告错误
|
发布文章
【字号:
大
|
中
|
小
】 【背景色
】
五. 文中源程序代码(Check.aspx)和执行的界面:
下图是执行了下列源程序代码(Check.aspx)后,生成的界面:
Check.aspx源程序代码如下:
<% @ Page Language = "C#" %>
<html >
<head >
<title > CheckBoxList组件演示程序 </title >
<script runat = "server" >
protected void Button_Click ( object sender , EventArgs e )
{
//组件中的检查框中的文本和选框的排列位置
switch ( cboAlign . SelectedIndex )
{
case 0 :
ChkList . TextAlign = TextAlign . Left ;
break ;
case 1 :
ChkList . TextAlign = TextAlign . Right ;
break ;
}
//组件中各个检查框布局
switch ( cboRepeatLayout . SelectedIndex )
{
case 0 :
ChkList . RepeatLayout = RepeatLayout . Table ;
break ;
case 1 :
ChkList . RepeatLayout = RepeatLayout . Flow ;
break ;
}
//组件中各个检查框排列方向
switch ( cboRepeatDirection . SelectedIndex)
{
case 0 :
ChkList . RepeatDirection = RepeatDirection . Vertical ;
break ;
case 1 :
ChkList . RepeatDirection = RepeatDirection . Horizontal ;
break ;
}
//组件中各个检查框的排列行数
try
{
int cols = int . Parse ( txtRepeatCols.Text ) ;
ChkList . RepeatColumns = cols ;
}
catch ( Exception )
{
}
lblResult . Text = "" ;
for ( int i = 0 ; i < ChkList . Items . Count ; i++ )
{
if( ChkList . Items [ i ] . Selected )
{
lblResult . Text += ChkList . Items [ i ] .Text + " <br > " ;
}
}
}
</script >
</head >
<body >
<form runat = "server" >
<h1 align = center > CheckBoxList组件演示程序 </h1 >
<table >
<tr >
<td > 组件中的文本排列位置: </td >
<td >
<asp:DropDownList id = cboAlign runat = "server" >
<asp:ListItem > 居左 </asp:ListItem >
<asp:ListItem > 居右 </asp:ListItem >
</asp:DropDownList >
</td >
</tr >
<tr >
<td > 组件中各个条目布局: </td >
<td >
<asp:DropDownList id = cboRepeatLayout runat = "server" >
<asp:ListItem > 表格型 </asp:ListItem >
<asp:ListItem > 紧凑型 </asp:ListItem >
</asp:DropDownList >
</td >
</tr >
<tr >
<td> 组件中各个条目排列方向:</td >
<td >
<asp:DropDownList id = cboRepeatDirection runat = "server" >
<asp:ListItem > 水平方向 </asp:ListItem >
<asp:ListItem > 垂直方向 </asp:ListItem >
</asp:DropDownList >
</td >
</tr >
<tr >
<td > 组件中各个条目排列行数: </td >
<td > <asp:TextBox id = "txtRepeatCols" runat = "server" /> </td >
</tr >
</table >
<br >
请选择你所需要学习的计算机语言类型:
<br >
<asp:CheckBoxList id = "ChkList" RepeatDirection = Horizontal runat = "server" >
<asp:ListItem > Visual C++ .Net </asp:ListItem >
<asp:ListItem > Visual C# </asp:ListItem >
<asp:ListItem > VB.NET </asp:ListItem >
<asp:ListItem > JScript.NET </asp:ListItem >
<asp:ListItem > Visual J# </asp:ListItem >
</asp:CheckBoxList >
<br >
<asp:Button Text = "提交" runat = "server" onclick = "Button_Click" />
<h1 > <font color = red > 你选择的计算机语言类型为: </font > </h1 >
<asp:Label id = lblResult runat = "server" />
</form >
</body >
</html >
六. 总结:
其实CheckBoxList组件也是一个服务器端组件。本文介绍了CheckBoxList组件中的一些主要的属性和方法,并且通过一个比较典型的例子说明了在ASP.NET页面中如何进行与CheckBoxList组件相关的编程,其实对于另外一个比较重要的组件--CheckBox来说,他们中有许多的相似之处,掌握了CheckBoxList组件的用法大致也就掌握了CheckBox组件的用法。
上一篇:
ADO.NET入门(1)
下一篇:
万维网创始人博客处女秀
我要投稿
打印本文
推荐本文
加入收藏
返回顶部
关闭窗口
01-12
ASP.NET 中如何防范SQL注入式攻击
12-16
关于Asp代码与页面的分离
11-21
ASP.NET中Server对象的方法
11-21
关于ASP.NET编程中的嵌套If语句
11-21
ASP.NET程序安全的基础知识
ASP.NET 中如何防范SQL注入式攻击
ASP.Net 对XML进行增删改查
ASP.Net实现Ajax多文件无刷新上传
.Net配置文件常用配置说明
ASP.NET热点问题解答14个
.NET下正则表达式应用的四个示例
asp.net 2.0中的URL重写以及url...
揭秘ASP.NET 2.0的Eval方法
.NET 和 Java 之碰撞火花:到底...
网站间共享数据的WebService
more..
» 相 关 评 论
验证码:
站长吧首页
-
网站运营
-
站长学院
-
SEO查询
-
站长论坛
-
建站服务
-
联系本站
-
广告/业务
©2005-2006 站长吧 Master8.NET All rights reserved 陕ICP备05010609号
九州未来科技提供服务器支持
| 网站空间 | 虚拟主机