牙签学技术

一根牙签的业余爱好
  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理

[ASP.NET]循环显示数据-Repeater

Posted on 2008-07-25 14:55 『一根牙签』 阅读(27) 评论(0)  编辑 收藏 所属分类: ASP.NET
sub 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

end sub




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

            
<ItemTemplate>

        
<tr align="center" valign="middle">

            
<td>

                
<%# DataBinder.Eval(Container.Dataitem,"ipid") %>

            
</td>

        
</tr>

        
</ItemTemplate>

    
</asp:Repeater>





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")

end sub
技术改变生活,生活改变思想,思想改变技术。
Tag标签: ASP.NET,Repeater