基本的Web控件三
基本的Web控件用法一
ListBox控件
页面布局:
<div>
<h1>ListBox控件</h1>
学生列表:
<br/>
<asp:ListBox ID="ListBox1" runat="server" Height="100px" Width="200px" Font-Size="Large"
onselectedindexchanged="ListBox1_SelectedIndexChanged" AutoPostBack="true" >
<asp:ListItem>张勇</asp:ListItem>
<asp:ListItem>张力</asp:ListItem>
<asp:ListItem>张译</asp:ListItem>
</asp:ListBox>
<br/>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<hr/>
<hr/>
</div>
后台代码:
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
this.Label1.Text = "你选择的学生是:" + this.ListBox1.SelectedItem.Text.ToString();
}
DropDownList控件
页面布局:
<div>
<h1>DropDownList控件</h1>
学生列表:
<br/>
<asp:DropDownList ID="DropDownList1" Font-Size="Large" runat="server" AutoPostBack="true" Width="146px"
OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>张宇</asp:ListItem>
<asp:ListItem>张容</asp:ListItem>
<asp:ListItem>张度</asp:ListItem>
</asp:DropDownList>
<br/>
<asp:Label ID="Label2" runat="server"></asp:Label>
<hr/>
<hr/>
</div>
后台代码:
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
this.Label2.Text="你选择的学生是:" +this.DropDownList1.SelectedItem.Text.ToString();
}
CheckBoxList控件
页面布局:
<div>
<h1>CheckBoxList控件</h1>
<asp:CheckBoxList ID="CheckBoxList1" runat="server" OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged"
AutoPostBack="true" Width="180px">
<asp:ListItem>苹果</asp:ListItem>
<asp:ListItem>香蕉</asp:ListItem>
<asp:ListItem>桔子</asp:ListItem>
<asp:ListItem>桂圆</asp:ListItem>
<asp:ListItem>葡萄</asp:ListItem>
</asp:CheckBoxList>
<br/>
<asp:Label ID="Label3" runat="server"></asp:Label>
<hr/>
<hr/>
</div>
后台代码:
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
this.Label3.Text = "你的选择是:" + this.CheckBoxList1.SelectedItem.Text.ToString();
}
RadioButtonList控件
页面布局:
<div>
<h1>RadioButtonList控件</h1>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" Width="180px">
<asp:ListItem>乒乓球</asp:ListItem>
<asp:ListItem>保龄球</asp:ListItem>
<asp:ListItem>羽毛球</asp:ListItem>
</asp:RadioButtonList>
<hr/>
<hr/>
</div>
BulletedList控件
页面布局:
<div>
<h1>BulletedList控件</h1>
<asp:BulletedList ID="BulletedList1" runat="server" BulletStyle="Square">
<asp:ListItem>鸡</asp:ListItem>
<asp:ListItem>鸭</asp:ListItem>
<asp:ListItem>猪</asp:ListItem>
<asp:ListItem>狗</asp:ListItem>
</asp:BulletedList>
<hr/>
<hr/>
</div>
Table控件
页面布局:
<div>
<h1>Table控件</h1>
<asp:Table ID="Table1" runat="server">
<asp:TableRow runat="server">
<asp:TableCell runat="server">第一行第一列</asp:TableCell>
<asp:TableCell ID="TableCell1" runat="server">第一行第二列</asp:TableCell>
<asp:TableCell ID="TableCell2" runat="server">第一行第三列</asp:TableCell>
<asp:TableCell ID="TableCell3" runat="server">第一行第四列</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow1" runat="server">
<asp:TableCell ID="TableCell4" runat="server">第二行第一列</asp:TableCell>
<asp:TableCell ID="TableCell5" runat="server">第二行第一列</asp:TableCell>
<asp:TableCell ID="TableCell6" runat="server">第二行第二列</asp:TableCell>
<asp:TableCell ID="TableCell7" runat="server">第二行第三列</asp:TableCell>
</asp:TableRow>
</asp:Table>
<hr/>
<hr/>
</div>
原文链接:
http://blog.csdn.net/spilledlight/article/details/48711979
基本的Web控件三的更多相关文章
- Web控件
Web控件可分三类 HTML控件 html服务器控件是在HTML控件的基础上,额外增加了一个在当前页面唯一的ID属性值和一个runat = "server" 属性html服务器控件 ...
- 一个完善的ActiveX Web控件教程
免费打工仔:一个完善的ActiveX Web控件教程 出自Ogre3D开放资源地带 跳转到: 导航, 搜索 原作者 David Marcionek. 翻译 免费打工仔 这个教程可以帮助你快速开发一 ...
- WEB控件没有什么所谓好不好,而是用得好不好
这几天Insus.NET有写几篇博文,虽然写得没怎么样,但均是Insus.NET现实开发过程中所遇或是所想的一些内容.<没有什么,开发ASP.NET时随便写写,想到什么写什么>http:/ ...
- Html控件和Web控件(转)
作为一名ASP.NET的初学者,了解并且区别一些混淆概念是很必须的,今天这篇博文 就是主要向大家介绍一下Html控件和Web控件.在ASP.net中,用户界面控件主要就是 Html控件和Web控件,在 ...
- 2015.2.16 关于delphi web控件打开新网页时弹出关闭页面(js代码)出错的解决办法研究
参考网址1:http://www.csharpwin.com/csharpspace/2360.shtml...参考网址2:http://www.oschina.net/question/234345 ...
- 033. asp.netWeb用户控件之二将页面转换成web控件和使用Web控件显示热点新闻
访问Web用户控件的属性 ASP.NET提供的各种服务器控件都有其自身的属性和方法,程序开发人员可以灵活地使用服务器控件中的属性和方法开发程序.在用户控件中,程序开发人员也可以自行定义各种属性和方法, ...
- [MFC] MFC 打开HTML资源(用ID版,也可加载到自己的web控件上)
@ ^ @:如果是加载到web控件上,就把注释掉的解除注释(改为web控件点后面的函数),把下一句注释 BOOL Button::LoadFromResource(UINT nRes){//打开网页加 ...
- 译:c#生成条码的web控件
译文:http://www.codeproject.com/Tips/846860/Csharp-Barcode-Generator-Web-Control 在asp.net的web页用c#的web控 ...
- Javascript语法去控制Web控件的Enabled属性
Web控件当使用Enabled属性时,它生成html之后会变成了disabled了.我们为了能够在javascript去控制控件的禁用与启用,得从这个disabled入手.如:
随机推荐
- 你应该知道的jQuery技巧
帮助提高你jQuery应用的简单小技巧. 回到顶部按钮 图片预加载 判断图片是否加载完 自动修补破损图像 Hover切换class类 禁用输入 停止正在加载的链接 toggle fade/slide ...
- 学习git遇到的一些简单错误
From:http://stackoverflow.com/questions/7574459/prompted-for-password-on-git-pull-origin-branch [roo ...
- $.ajax获取不到数据问题解决
$("#updateflow").click(function () { $.ajaxSetup({ contentType: "application/json;cha ...
- 转: Ubuntu 安装字体方法
命令安装: 以微软雅黑字体为例(其他的宋体.黑体等点阵字体都一样的),我们的雅黑字体文件是:Yahei.ttf(放在自己的主目录下)(在widows目录的Fonts目录下找需要的字体)由于我是双系 ...
- photoshop CS 调整选择区域的大小
网上看到说:矩形选框不能直接调整大小,如果你不想重新画一个可以利用转换路径,然后再调整.这是不对的,矩形选框是可以调整大小的,使用"变换选区"即可. 对应步骤截图如下: 1.画 ...
- LeetCode 58. Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the l ...
- PinYinCls
using System;using System.Data;using System.Configuration;using System.Linq;using System.Web;using S ...
- 页面设计--Grid列表
Grid列表控件 功能:主要实现Html Table功能,支持多表头.固定表头.固定列.输出.组合查询.编辑功能 优点:可以快速的通过数据集合生成多表头.多样式的列表.通过简单的拖拉实现多层表头. G ...
- SQL执行的原理以及一些常见的关键字
sql语句在面试里面问道的问题: sql的解析的顺序 1.where里面的条件是从右向左扫描解析 2.from里面的大表在前,小表在后,解析的顺序是从右向左解析. 3.left/right/inner ...
- 日期:Date
API--- java.util.Date:日期类,月份从0-11: 日期对象和毫秒值之间的转换. 1,日期对象转成毫秒值.Date类中的getTime方法. 2,如何将获取到的毫秒值转成具体的日期呢 ...