Código:
Private Sub muestraDatalist()
Dim i, paginar, inicio, CurrentPage, pageCountador, recordContador as Integer
paginar=15 ' 15 records
if request.querystring("page")="" then
inicio = 0
else
inicio = (request.querystring("page") - 1) * paginar
end if
Dim oConn As New SqlConnection("tu conexion sql o lo qeu sea de bade de datos")
Dim DS As New DataSet()
Dim MicmdaD As New SqlDataAdapter("select * from tabla", oConn )
MicmdaD.Fill(DS, "tabla")
recordContador = DS.Tables(0).Rows.Count
MicmdaD.Fill(DS, inicio, paginar, "tabla")
DataList1.DataSource = DS.Tables("tabla").DefaultView
DataList1.DataBind()
pageCountador = int ((recordContador-1)/paginar)+1
CurrentPage = int (inicio / paginar)+1
inicio= (currentpage - 1) * paginar
mensajes.text="<font color='#003399' size=2px >Total de mensajes: </font>" & recordContador
pagina.text="<font color='#003399' size=2px >Estas en la pagina:</font> <font color='#FF0000' size=2px>" & CurrentPage & "</font>"
for i=1 to pageCountador
if i=CurrentPage then
etiquetacon.text = etiquetacon.text & "<a href=""autos.aspx?page=" & i & """ style='text-decoration:none;color:#003366;'><font color='#FF0000' size=2px>" & i & "</font></a> "
else
etiquetacon.text = etiquetacon.text & "<a href=""autos.aspx?page=" & i & """ style='text-decoration:none;color:#003366;'>" & i & "</a> "
end if
next
End sub
solo qe a tu datalist ponle bien los atributos de header, footer etc
porque te duplica al paginar pero aqui tienes como te debe de quedar, claro si eres mas diseñador que programador porque yo no ocupo el codebehind
<ASP:DataList id="DataList1" runat="server" DataKeyField="id" >
<HeaderTemplate>
<table >
<tr>
<td>nombre</td>
<td>dir</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr >
<td><%#Container.DataItem("campo"></td>
<td><%#Container.DataItem("campo")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:DataList>
<asp:Label ID="mensajes" runat="server" BackColor="#FFFFFF" />...
<asp:Label ID="pagina" runat="server" BackColor="#FFFFFF" /> <br>
Paginador >> <asp:Label ID="etiquetacon" runat="server" BackColor="#FFFFFF" />
saludos.. espero que te sirve mi code chairo