page_load(o as object,e as eventargs)
if ispostback then exit sub
dim obj as new DatabaseDo
obj.connstr=ConfigurationSettings.AppSettings("ConnstrACC")
dim ds as dataset
'====================
'== 绑定数据类型 ==
'====================
ds=obj.getdataset("select * from Ip")
IP.datasource=ds
IP.databind
<asp:Repeater ID="Newslist" runat="server">
<ItemTemplate>
<tr align="center" valign="middle">
<td>
<%# DataBinder.Eval(Container.Dataitem,"ipid") %>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
page_load()sub page_load(o as object,e as eventargs)
dim obj as new databaseDo
dim ds as dataset
obj.connstr=ConfigurationSettings.AppSettings("Connstr")
ds=obj.getdataset("select iid,iname,idesc1,sysdate,iimage from information where itype=1 order by sysdate ")
tjList.datasource=ds
tjList.databind()
ds=obj.getdataset("select top 10 iid,iname,idesc1,sysdate,iimage from information where itype=7 order by sysdate desc ")
tjList1.datasource=ds
tjList1.databind()
ds=obj.getdataset("select * from datalist where isshow='Y' and ptype=1")
ProductListA.datasource=ds
ProductListA.databind()
ds=obj.getdataset("select * from datalist where isshow='Y' and ptype=2")
ProductListB.datasource=ds
ProductListB.databind()
Label显示方法
ds=obj.getdataset("select count(*) c from information where itype=7")
intQty.text=ds.tables(0).rows(0).item("c")
[ASP.NET]循环显示数据-Repeater
最新推荐文章于 2019-05-15 09:35:31 发布