Do you know how to allow paging in datalist?
I get some source code on the internet, but they didnt mention how to connect to the database, the code just show to connect to the fix data( red color part). I need to connect to my database(enterprise) and table(Contents), so anyone can help me?
Example source code get from other website:
<%@ Page Language="
VB" %>
<script language="
VB" runat="server">
Sub Page_Load(byVal obj As Object, byVal e As EventArgs)
doPaging()
End Sub
Sub doPaging()
Dim mockData As New HashTable()
Dim IDx As Integer = 0
Do Until IDx = 500
mockData.Add(IDx.toString(), (IDx * 101).toString)
IDx += 1
Loop
Dim pagedData As New PagedDataSource()
pagedData.DataSource = mockData
pagedData.AllowPaging = True
pagedData.PageSize = 5
theDataList.DataSource = pagedData
theDataList.DataBind()
End Sub
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Paging Example 1</title>
</head>
<body>
<asp:DataList id="theDataList" runat="server">
<ItemTemplate>
Department: <%# DataBinder.Eval(Container.DataItem,
"Key") %><br />
Employee ID: <%# DataBinder.Eval(Container.DataItem,
"Value") %></a><br />
</ItemTemplate>
</asp:DataList>
</body>
</html>