在aspx页面引入Repeater控件,控件必须在<form runat="server" id="xxx"></form>中
<form id="userinfo1_form" runat="server"> <div> <asp:Repeater ID="userlist" runat="server" OnItemCommand="userlist_ItemCommand"> <HeaderTemplate> <table width="700" border="0" cellpadding="3" cellspacing="1" align="center" style="background-color: #b9d8f3;"> <tr style="text-align: center; color: #0076C8; background-color: #F4FAFF;"> <th width="20%" align="center"> ID </th> <th width="20%" align="center"> 用户名 </th> <th width="20%" align="center"> 密码 </th> <th width="20%" align="center"> 年龄 </th> <th width="20%" align="center"> 操作 </th> </tr> </table> </HeaderTemplate> <ItemTemplate> <table width="700" border="0" cellpadding="3" cellspacing="1" align="center" style="background-color: #b9d8f3;"> <tr style="text-align: center; color: #0076C8; background-color: #F4FAFF;"> <td width="20%" align="center"> <%#Eval("id") %> </td> <td width="20%" align="center"> <%#Eval("name") %> </td> <td width="20%" align="center"> <%#Eval("password") %> </td> <td width="20%" align="center"> <%#Eval("age") %> </td> <td width="20%" align="center"> <a href="edit.aspx?name=<%#Eval("name") %>&password=<%#Eval("password") %>&age=<%#Eval("age") %>">编辑</a> </td> </tr> </table> </ItemTemplate> </asp:Repeater> </div> </form>
在cs文件中代码
protected void Page_Load(object sender, EventArgs e) { bind(); } protected void userlist_ItemCommand(object source, RepeaterCommandEventArgs e) { bind(); } //数据绑定 private void bind() { DataTable dt = userinfo_dal.GetUserInfoList(connectionstr); this.userlist.DataSource = dt.DefaultView; this.userlist.DataBind(); }
相关推荐
ASP.NET Repeater分页,查询分页 ASP.NET Repeater分页,查询分页 ASP.NET Repeater分页,查询分页 ASP.NET Repeater分页,查询分页 ASP.NET Repeater分页,查询分页
Asp.Net Repeater的使用十分方便,用户可以根据自己的爱好来确定页面显示数据的样式。这里主要讲述Asp.Net Repeater中使用Button控件并响应单击操作的方法
ASP.NET Repeater 简单的增删改查分页例子(附数据库,下载即可运行),适合新手使用,本例使用三层架构搭建,实现增删该查以及分页功能,代码简洁,注释详细,欢迎大家下载使用。
asp.net Repeater控件 应用实例 简单的留言板
asp.net Repeater中使用if的和asp.net日期绑定的转换
经过对ASP.NET中Repeater数据控件基本特征的分析,以及对实际应用系统中数据列表功能的提炼总结,提出并设计了挖掘其潜力的示例算法模型,重点介绍了控件模板的灵活性与定制使用方法。并通过典型应用示例,展示其...
演示如何将ASP.NET Repeater控件用于就地编辑和添加项目
关于repeater嵌套的方法,使用!! 希望对大家有帮助!!!!
用repeater控件实现像微博收听那样的外观功能,并将信息记录到数据库,文件里带有数据库!需要在sqlserver里附加数据库进去!
ASP.NET-repeater控件使用
asp.net分页第三方控件 非常好用 grideView,datalist等绑定
asp.net装载页面进度条以及Repeater分页
ASP.NET asp:Repeater 控件 本章介绍如何通过 Repeater 控件将数据绑定到一个 XML 文件。 ASP.NET asp:DataList 控件 本文讲解使用 DataList 控件把数据绑定到 XML 文件。 ASP.NET Database ASP.NET 数据库连接 ...
在项目开发过程中,会经常遇到ASP.NET repeater控件添加序号列,有些新手可能还不会,网上搜集整理了一些,需要的朋友可以参考下
asp.net repeater绑定函数使用实例
asp.net(c#)利用Repeater取得CheckBox选中行的某个值的代码
批量删除涉及到的内容: 1、删除的SQL语句的拼凑,例如delete... 您可能感兴趣的文章:ASP.NET repeater添加序号列的方法asp.net Repeater取得CheckBox选中的某行某个值的c#写法asp.net repeater手写分页实例代码asp.net
Asp.net提供了三个功能强大的列表控件:DataGrid、DataList和Repeater控件,但其中只有DataGrid控件提供分页功能。相对DataGrid,DataList和Repeater控件具有更高的样式自定义性,所以很多时候我们喜欢使用DataList...
【ASP.NET编程知识】asp.net使用Repeater控件中的全选进行批量操作实例.docx
在ASP.NET 2.0中操作数据:格式化DataList和Repeater的数据