《ASP.NET》数据的绑定―Repeater图文详解


当前第2页 返回上一页

显示效果如下,结构只显示2、4、6、9列,这就是所谓的交叉显示。

最后,我将五个模板一块使用,前台代码如下

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

<asp:Repeater ID="Repeater1" runat="server">

                <HeaderTemplate>

                    <h3 align="center">页眉模板</h3>

                </HeaderTemplate>

 

                <ItemTemplate>

                    <p align="center">

                        <font color="blue"> <%# DataBinder.Eval(Container.DataItem,"pID") %>

                        <%# DataBinder.Eval(Container.DataItem,"personName") %>

                        <%# DataBinder.Eval(Container.DataItem,"personSex") %></font>

                    </p>

                </ItemTemplate>

                <AlternatingItemTemplate>

                    <p align="center">

                        <font color="blue"> <%# DataBinder.Eval(Container.DataItem,"pID") %>

                        <%# DataBinder.Eval(Container.DataItem,"personName") %>

                        <%# DataBinder.Eval(Container.DataItem,"personSex") %></font>

                    </p>

                </AlternatingItemTemplate>

 

                <SeparatorTemplate>

                    <hr color="red" size="1" />

                </SeparatorTemplate>

 

                <FooterTemplate>

                    <h3 align="center">页脚模板</h3>

                </FooterTemplate>

 

            </asp:Repeater>

显示效果图如下


这就是利用控件将后台数据库中的信息用浏览器显示出来的方法,其实不光Repeater控件,像DataList,GridView,CheckBoxList、DropDownList等等都能将数据库中的信息加以绑定然后再在浏览器中显示出来,后面我会一一介绍,敬请期待!!

??

以上就是《ASP.NET》数据的绑定―Repeater图文详解的详细内容!

返回前面的内容

相关阅读 >>

asp.net core简单介绍教程(1)_实用技巧

如何使用会话状态(asp.net web 服务)

关于asp.net如何获取浏览器访问的ip地址?

asp.net中partial class部分类

asp.net使用entityframeworkcore codefrist

详细介绍一款.net代码编辑控件(icsharpcode.texteditor)

有关asp.net如何实现多个文件同时下载问题相关解答

asp.net mvc 对输入的字符串字段做trim处理的方法_实用技巧

asp.net 获取 客户端ip

asp.net中有关config文件的读写功能讲解

更多相关阅读请进入《数据的绑定》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...