基本的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入手.如:
随机推荐
- MySQL运算符之 <=>
问题 : 我在看以前的一个开发者的代码时看到 WHERE p.name <=> NULL 在这个查询语句中 <=>符号是什么意思啊?是不是和 =号是一样啊?还是一个语法错误啊? ...
- 如何使用javadoc
package com.frank.chapter1; // object.Documentation1.java // TIJ4 Chapter Object, Exercise 13 - 1 /* ...
- 谈Objective-C Block的实现
来源:http://blog.devtang.com/blog/2013/07/28/a-look-inside-blocks/ 前言 这里有关于block的5道测试题,建议你阅读本文之前先做一下测试 ...
- JSON.stringify()的使用--将string转换成json
===========================================================1. ====JSON.stringify()================== ...
- Java调用ffmepg+mencoder视频格式转换(*)
PS: 建议大家在官网下载最新的资源 其他格式转FLV格式,可以用Java调用ffmpeg和memcoder实现 ffmepg: D:\ffmpeg\bin\ffmpeg.exe -i E:\1.mp ...
- 使用NodeJS将XML解析成JSON及性能比较
并不是所有的API都是以JSON格式返回的.我们有时侯不得不处理一些XML.幸运的是有一个NodeJS模块 xml2js 可以帮你做这件事. 比如,我们要处理下面这段XML <?xml ...
- [Java] 过滤流BufferedInputStream和BufferedOutputStream
package test.stream; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import ...
- java学习_文件工具类
工具类里面的方法全部都是静态的,调用的时候不需要实例化
- editplus格式化xml文档
使用editplus打开xml文档,发现文件内容没有格式化,非常难看,使用IE9打开这个xml文档是格式化的,但是IE9打开不能编辑. 在网上找了一些资料发现能够通过一个小插件来是editplus格式 ...
- sql如何获取一个时间段内的月份
),) from master..spt_values where type='P' and dateadd(month,number,'2010-01-01')<='2010-09-01' / ...