' ASPX_DataList_using_wucDataSet.aspx.vb.txt
' The DataList is very similar to the repeater
'
' Mostly writen by Dan Garlen dan.g@kgsystems.com 2/22/04
' Last modified: 3/20/04
'
' Use at your own risk - but, have fun doing it.
' Portions of this code have been shamlessly copied from other unnamed sources - thank you to all.
'
' Requires: ASCX_Northwind_Dataset_and_Status_WebUserControl_wucDataSet.ascx.vb.txt
'
' Place a copy of "Northwind.mdb" in the project virtual directory ie C:\InetPub\wwwRoot\DataListExample
'
' Create this Client WebForm with a Repeater (leave default name of "Repeater1")
' Drag "wucDataSet.ascx" onto WebForm
' Leave name as default "WucDataSet1"
'
' Paste the following block of code in place of the empty Page_Load:
Protected WithEvents wucDataSet1 As wucDataSet
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ds As DataSet = wucDataSet1.dsNorthwind
If wucDataSet1.Status Then
Dim dt As DataTable = ds.Tables("tblCustomers")
Dim dv As New DataView(dt)
dv.Sort = "Country"
DataList1.DataSource = dv
DataList1.DataBind()
End If
End Sub
====================================================================================================
Open the HTML View of the WebForm
Locate the following:
Paste AS HTML (under Edit menu) as shown between the two tags: