基本的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入手.如:
随机推荐
- 1小时vpn coding让开发更简单 或https://www.imfreevpn.org/
- map遍历测试结果
结论:一般情况下推荐使用enterSet的for循环(即以下的方法2),如果只是取key值可以使用keySet性能会更好. 因为keySet只取key,enterSet即取了key又取了value. ...
- wpf mvvm使用问题集锦
问题一.usercontrol1控件使用了mvvm数据绑定,usercontrol2也使用了mvvm数据绑定,则 以下是伪代码 <usercontrol2 datacontent="{ ...
- How to control PrincipalObjectAccess table growth in Microsoft Dynamics CRM 2011
https://support.microsoft.com/en-us/kb/2664150 How to control PrincipalObjectAccess table growth in ...
- MapHttpRoute
http://aspnetwebstack.codeplex.com/SourceControl/latest#src/System.Web.Http/HttpRouteCollectionExten ...
- oracle 监听动态和静态的配置
[oracle@oracledb1 admin]$ vi listener.ora # listener.ora Network Configuration File: /u01/app/oracle ...
- 学习记录 彻底搞清 C#中a++与++a的区别
首先 a++和++a 的定义:看个例子A: a=5; b=++a; // 相当于a=a+1;b=a; 结果是a=6,b=6B: a=5; b=a++; // 相当于b=a;a=a+1; 结果是a=6, ...
- bzoj1433: [ZJOI2009]假期的宿舍
1433: [ZJOI2009]假期的宿舍 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 2286 Solved: 969[Submit][Stat ...
- Java程序员面试宝典——重要习题整理
1.下面程序的输出结果是() public class Test { public static void main(String[] args) { int j = 0 ; for(int i = ...
- 【MySQL】MySQL无基础学习和入门之一:数据库基础概述和实验环境搭建
数据库基础概述 大部分互联网公司都选择MySQL作为业务数据存储数据库,除了MySQL目前还有很多公司使用Oracle(甲骨文).SQLserver(微软).MongoDB等. 从使用成本来区分可以 ...