Hello!
I can't manage to get detail of product in the new URL (neither sorting).
Pasting both files.
If someone have courage to take a look...
Thank you.
<%@ Import NameSpace="System.Data" %>
<%@ Import NameSpace="System.Data.OleDB" %>
<%@ Page Language="
VB" Debug="true" %>
<html>
<head>
<title>serafim</title>
<script language="
vb" runat="server">
Protected WithEvents NomeSort As LinkButton
Protected WithEvents MoradaSort As LinkButton
Protected strOrderBy As String
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
If Not Page.IsPostBack() Then
intPageSize.Text = "2"
intCurrIndex.Text = "0"
strOrderBy = "nome"
DataBind()
End If
End Sub
Private Sub DataBind()
Dim objConn As New OleDBConnection("Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source=C:\Inetpub\wwwroot\DOT\teste\Pessoal_teste. mdb")
Dim objDA As New OleDBDataAdapter("select * from Tabela order by Nome", objConn)
Dim objDS As New DataSet()
If Not Page.IsPostBack() Then
objDA.Fill(objDS)
intRecordCount.Text = CStr(objDS.Tables(0).Rows.Count)
objDS = Nothing
objDS = New DataSet()
End If
objDA.Fill (objDS, Cint(intCurrIndex.Text), CInt(intPageSize.Text), "Tabela")
dList.DataSource = objDS.Tables(0).DefaultView
dList.DataBind()
objConn.Close()
PrintStatus()
End Sub
Protected Sub NomeSort_Click(ByVal sender As Object, ByVal e As EventArgs) Handles NomeSort.Click
strOrderBy = "Nome"
DataBind()
End Sub
Protected Sub MoradaSort_Click(ByVal sender As Object, ByVal e As EventArgs) Handles MoradaSort.Click
strOrderBy = "Morada"
DataBind()
End Sub
Public Sub ShowFirst(ByVal s As Object, ByVal e As EventArgs)
intCurrIndex.Text = "0"
DataBind()
End Sub
Public Sub ShowPrevious(ByVal s As Object, ByVal e As EventArgs)
intCurrIndex.Text = Cstr(Cint(intCurrIndex.Text) - CInt(intPageSize.Text))
If CInt(intCurrIndex.Text) < 0 Then
intCurrIndex.Text = "0"
End If
DataBind()
End Sub
Public Sub ShowNext(ByVal s As Object, ByVal e As EventArgs)
If CInt(intCurrIndex.Text) + 1 < CInt(intRecordCount.Text) Then
intCurrIndex.Text = CStr(CInt(intCurrIndex.Text) + CInt(intPageSize.Text))
End If
DataBind()
End Sub
Public Sub ShowLast(ByVal s As Object, ByVal e As EventArgs)
Dim tmpInt as Integer
tmpInt = CInt(intRecordCount.Text) Mod CInt(intPageSize.Text)
If tmpInt > 0 Then
intCurrIndex.Text = Cstr(CInt(intRecordCount.Text) - tmpInt)
Else
intCurrIndex.Text = Cstr(CInt(intRecordCount.Text) - CInt(intPageSize.Text))
End If
DataBind()
End Sub
Private Sub PrintStatus()
lblStatus.Text = "Nº de Produtos:<b>" & intRecordCount.Text
lblStatus.Text += "</b> - Página:<b> "
lblStatus.Text += CStr(CInt(CInt(intCurrIndex.Text) / CInt(intPageSize.Text)+1))
lblStatus.Text += "</b> de <b>"
If (CInt(intRecordCount.Text) Mod CInt(intPageSize.Text)) > 0 Then
lblStatus.Text += CStr(CInt(CInt(intRecordCount.Text) / CInt(intPageSize.Text)+1))
Else
lblStatus.Text += CStr(CInt(intRecordCount.Text) / CInt(intPageSize.Text))
End If
lblStatus.Text += "</b>"
End Sub
</script>
</head>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<h2 align="center">Lista de Produtos</h2>
<a name="this"></a>
<asp:DataList ID="dList" Runat="server" Width="100%"
ItemStyle-BackColor="Beige"
ItemStyle-Font-Name="Verdana"
BorderWidth="1"
HeaderStyle-Font-Name="Verdana"
EnableViewState="False">
<HeaderTemplate>
Ordem: <asp:LinkButton ID="NomeSort" Runat="server" OnClick="NomeSort_Click">Nome</asp:LinkButton>
<asp:LinkButton ID="MoradaSort" Runat="server" OnClick="MoradaSort_Click">City</asp:LinkButton>
<table width="100%" style="font: 10pt verdana" cellpadding=0 cellspacing=0>
<tr style="background-color:FF0000">
<th align=left>Numero</th>
<th align=left>Produto</th>
<th align=left>Morada</th>
<th align=left>Nacionalidade</th>
<th align=left>Detalhes</th>
<th align=left>Imagem</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#f5f5dc">
<td><%# DataBinder.Eval(Container.DataItem, "id") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "nome") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "morada") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "nacionalidade") %></td>
<td><a title="Detalhes de <%# DataBinder.Eval(Container.DataItem, "Nome") %>" CommandName="Select" href="datalistsort2.aspx?id=<%# DataBinder.Eval(Container.DataItem, "ID") %>">Detalhes</a></td>
<td><img src="imagens/<%#((DataBinder.Eval(Container.DataItem, "ID"))) %>.bmp" height="45"></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:DataList>
<table width=100% align="right">
<tr>
<td width=76% align=left>
<asp:label ID="lblStatus" Runat="server" Font-Name="verdana" Font-Size="10pt" />
</td>
<td width=6%>
<a href="default4b.aspx#this"
ID="hrefFirst"
onserverclick="ShowFirst"
runat="server">Primeiro </b></a>
</td>
<td width=6%>
<a href="default4b.aspx#this"
ID="hrefPrevious"
onserverclick="ShowPrevious"
runat="server"> Anterior </b></a>
</td>
<td width=6%>
<a href="default4b.aspx#this"
ID="hrefNext"
onserverclick="ShowNext"
runat="server">
Próximo </b></a>
</td>
<td width=6%>
<a href="default4b.aspx#this"
ID="hrefLast"
onserverclick="ShowLast"
runat="server"> Ãltimo</b></a>
</td>
</tr>
<asp:label ID="intCurrIndex"
Visible="False"
Runat="server" />
<asp:label ID="intPageSize"
Visible="False"
Runat="server" />
<asp:label ID="intRecordCount"
Visible="False"
Runat="server" />
</form>
</body>
</html>
------------------
<%@ Page Language="
VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<head>
<title>thumbnails from access database</title>
</head>
<script language="
VB" Debug="true" runat="server">
Sub Page_Load(src As Object, e As EventArgs)
If Not IsPostBack Then
bindListControl
End If
End Sub
Sub display_image(src As Object, e As EventArgs)
If Not IsPostBack Then
bindListControl
End If
End Sub
Sub bindListControl()
Dim myConn As OleDbConnection
Dim myOleDbAdapter As OleDbDataAdapter
Dim connStr, sqlStr As String
Dim myDataSet As New Dataset
connStr="Provider=Microsoft.Jet.OLEDB.4.0;Data source=C:\Inetpub\wwwroot\DOT\teste\pessoal_teste. mdb;"
sqlStr="SELECT * FROM Tabela"
myConn= New OleDbConnection(connStr)
myConn.Open()
myOleDbAdapter =New OleDbDataAdapter(sqlStr,myConn)
myOleDbAdapter.Fill(myDataSet,"Tabela")
dList.DataSource=myDataSet.Tables("Tabela")
dList.DataBind()
End Sub
</script>
<body bgcolor="white">
<form id="Form1" method="post" runat="server">
<h2 align="center">Lista de Produtos</h2>
<a name="this"></a>
<asp:DataList ID="dList" Runat="server" Width="100%"
ItemStyle-BackColor="Beige"
ItemStyle-Font-Name="Verdana"
BorderWidth="1"
HeaderStyle-Font-Name="Verdana"
EnableViewState="False">
<HeaderTemplate>
<table width="100%" style="font: 10pt verdana" cellpadding=0 cellspacing=0>
<tr style="background-color:FF0000">
<th align=left>Numero</th>
<th align=left>Produto</th>
<th align=left>Morada</th>
<th align=left>Nacionalidade</th>
<th align=left>Detalhes</th>
<th align=left>Imagem</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#f5f5dc">
<td><%# DataBinder.Eval(Container.DataItem, "id") %> </td>
<td><%# DataBinder.Eval(Container.DataItem, "nome") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "morada") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "nacionalidade") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "Nome") %></td>
<td><img src="imagens/<%#((DataBinder.Eval(Container.DataItem, "ID"))) %>.bmp" height="45"></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:DataList>
</form>
</body>
</html>