DataList和Repeater
DataList和Repeater是两个十分有用的控件,在新闻列表和图片展示的地方经常用到。在这里简单的把他们介绍一下。
1.DataList:
前端页面:
<asp:DataList ID="PicList" runat="server" RepeatColumns="3" Width="90%" RepeatDirection="Horizontal"> <ItemStyle. BorderWidth="0" BorderStyle="none" Width="200" HorizontalAlign="center" /> <ItemTemplate> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td height="110px"> <img src='<%# Eval("IMGurl") %>' width="174" height="130" alt="" style="cursor: hand;" /> </td> </tr> <tr> <td align="center" height="40px"> <asp:Label ID="Content" runat="server" Width="100%" Text='<%# Eval("IMGms") %>' /></td> </tr> </table> </ItemTemplate> </asp:DataList>
属性介绍:RepeatColumns:在横向或书香重复的条数;
RepeatDirection:重复方向。
后台代码:
this.PicList.DataSource = ds; this.PicList.DataBind();
2.Repeater:使用方式更简单,
<asp:Repeater ID="Repeater3" runat="server"> <ItemTemplate> <div align="left" class="divp1"> <img src="Images/jt.gif" width="10" height="11" alt="" /> <a href='Talent.aspx?nurl=<%# Eval("MenuURL") %>' target="_blank"><strong><%# Eval("MenuName") %></strong></a>
</ItemTemplate> </asp:Repeater>
后台类似datalist。
DataList和Repeater的更多相关文章
- Gridview、DataList、Repeater获取行索引号
Gridview.DataList.Repeater如何获取行索引号?很多情况下都会用得到,下面贴出代码,注意行索引号是从0开始,不是从1开始,如果要从1开始,请在代码里面+1就行了. Gridvie ...
- DataList与Repeater嵌套绑定
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="home.aspx.cs&quo ...
- GridView、DataGrid、DataList、Repeater、ListView、DetailsView、FormView
列表类 GridView 控件 GridView 控件以表的形式显示数据,并提供对列进行排序.分页.翻阅数据以及编辑或删除单个记录的功能. 特征:一行一条记录,就像新闻列表一样:带分页功能 ...
- 在DataList、Repeater的HeaderTemplate和FooterTemplate模板中寻找控件FindControl
[程序代码] <asp:Repeater ID="Repeater1" runat="server"> <HeaderTemplate> ...
- DataList、Repeater、GridView中的Checkbox取值问题
先看页面代码 <asp:DataList id="DataList1" runat="server" Width="100%" Rep ...
- repeater单双行颜色不同,gridview repeater DataList 鼠标经过改变背景颜色
1.gridview 双击GridView的OnRowDataBound事件: 在后台的GridView1_RowDataBound()方法添加代码,最后代码如下所示: protected void ...
- Repeater, DataList, 和GridView控件的区别
http://blog.sina.com.cn/s/blog_646dc75c0100h5p6.html http://www.cnblogs.com/phone/archive/2010/09/15 ...
- 【转】通用分页用户控件(DataGrid,DataList,Repeater都可以用它来分页)
通用分页控件(DataGrid,DataList,Repeater都可以用它来分页) 1.建立用户控件Pager.ascx 1.1 html </ASP:LABEL></TD> ...
- Repeater, DataList, 和GridView的区别及使用
从对象层次图可以看出,Repeater是最轻最小的控件,它仅仅继承了基本控件的功能,包括ID属性.子控件集合等.另一方面,DataList和DataGrid则继承了WebControl功能,包括样式和 ...
随机推荐
- cocos2d-x 添加纹理自动回收机制
转自:http://www.cnblogs.com/lancidie/archive/2013/04/13/3019375.html 1.不是一个完整的模块,所以不提供完整代码,只提供思路和核心代码. ...
- 对PostgreSQL xmin的深入学习
当PostgreSQL需要insert 一条记录的时候,它会把记录头放入xmin,xmax等字段. xmin的值,就是当前的Transaction的TransactionId.这是为了满足MVCC的需 ...
- Xcode repository host is unreachable
遇到这个错误,首先不要急.按照如下方法即可(如果你的svn地址没有问题的话): url要使用域名,所以映射下 1. 修改host:在应用程序里面打开终端(terminal),输入 sudo vi /e ...
- 【WPF】 打开本地的文件或者文件夹
问题描述: 我做的程序中需要添加帮助文档,我将文档生成了CHM格式,在用户点击帮助按钮时候 弹出帮助文档. 实现方法: System.Diagnostics.Process.Start(AppDoma ...
- C#-设置窗体在显示器居中显示
在窗体的属性中查看:StartPosition属性,该属性的设置中有一个"CenterScreen"的选择项,该项就是设置窗体局中显示的.
- BZOJ 1934: [Shoi2007]Vote 善意的投票 最小割
1934: [Shoi2007]Vote 善意的投票 Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnl ...
- Android ListView快速定位(三)
方法三: android:fastScrollEnabled="true" 这个很简单,只要把属性设置了,就可以起作用了 不过这个滑块比较丑,当然网上也有自定义图片的例子. 参考 ...
- windows MySQL 5+ 服务手动安装
一.手动安装mysql 1.准备一个mysql免安装版本(把原来安装好的版本复制一份即可.一次安装多次使用^_^),将mysql复制到指定目录. 2.配置my.ini文件(本例使用的是5.0.22版本 ...
- careercup-中等难度 17.8
17.8 给定一个整数数组(有正数和负数),找出总和最大的连续序列,并返回总和. 解法: 就是求连续子序列的和最大,不过存在一个问题: 假设整个数组都是负数,怎么样才是正确的行为呢?看看这个简单的数组 ...
- org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto ...