基本的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入手.如:
 
随机推荐
- Python进阶06 循环对象
			
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 这一讲的主要目的是为了大家在读Python程序的时候对循环对象有一个基本概念. 循 ...
 - spring整合struts
			
整合目标:使用spring的bean管理struts action service. 整合步骤: 一.加入spring 1.加入spring jar包 2.配置web.xml文件 <contex ...
 - [Java]  java中方法可以重载
			
一个类中可以定义不止一个构造器,在使用new创建对象时,Java会根据构造器提供的参数来决定构建哪一个构造器,另外在Java中,Java会同时根据方法名和参数列表来决定所要调用的方法,这叫做方法重载( ...
 - free 查看系统内存
			
第二部分(-/+ buffers/cache):(-buffers/cache) used内存数:286M (指的第一部分Mem行中的used – buffers – cached)(+buffers ...
 - java中读取文件以及向文件中追加数据的总结
			
package gys; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; imp ...
 - 4.1.1  A - Calendar(简单线性表)(日期查找)(数组应用)
			
Description A calendar is a system for measuring time, from hours and minutes, to months and days, a ...
 - (转)一段如何調用Button.Click事件的故事
			
原文地址:http://helloouc.blog.163.com/blog/static/5530527120091050314590/ 一.前言 由于小朱与BillChung的启发,想写一个故事, ...
 - c# MessageBox使用
			
最近一直用到winform的MessageBox,感觉还是很混乱.刚好在网上发现xuenzhen的博客,特此借鉴记录一些东西. 下面的MessageBox的九中用法,来自xuenzhen的博客:htt ...
 - addAll()报NullPointer原因
			
如下代码在注释行会报错,原因是:getSeatTravelerInfo()时值为空,对空对象addAll会报错 SeatBookingInfo b=new SeatBookingInfo(); b.s ...
 - Troubleshooting 'library cache: mutex X' Waits.
			
What is a 'library cache: mutex X' wait? The mutex feature is a mechanism to control access to in me ...