项目里一直用DataGrid/WebGrid,几乎快要忘记这个控件了[emot]shy[/emot]
刚好前阵子打算自己边学边写点东西,要用的,拿来温故下
今天开始,不定期放些相关内容备忘&分享[emot]smile[/emot]
Aspx文件
















Publisher ID Price

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

<%# DataBinder.Eval(Container.DataItem, "price", "$ {0}") %>



*.VB文件

#Region "Repeater数据绑定"
Private Function BindDataList() As Boolean
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

MyConnection = New SqlConnection("server=wxhy-lee;database=Pubs;uid=sa;pwd=sa")
MyCommand = New SqlDataAdapter("select top 6 * from Titles", MyConnection)

DS = New DataSet
MyCommand.Fill(DS, "Titles")

MyRepeater.DataSource = DS.Tables("Titles").DefaultView
MyRepeater.DataBind()
End Function
#End Region

Back