datagrid paging

D

dibusi

i have a trouble with datagrid with web matrix.It doesn't browse the records
when i click on the navigation buttons of the datagrid.it displays only the
first records.
thankyou for the help.
Sub Page_Load(Sender As Object, E As EventArgs)

If Not Page.IsPostBack Then

' Databind the data grid on the first request only
' (on postback, rebind only in paging command)
DATAGRID1.VirtualItemCount=2000
BindGrid()

End If

End Sub

Sub DataGrid_Page(Sender As Object, e As DataGridPageChangedEventArgs)
BindGrid()
DataGrid1.CurrentPageIndex = e.NewPageIndex
End Sub
sub BindGrid()

' TODO: update the ConnectionString value for your application
' DataGrid1.DatakeyField="AMAT_NUME_TIERS"
Dim ConnectionString AS String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\assmat\bdamat2000.MDB"
'Dim ConnectionString As String =
"server=(local);database=pubs;trusted_connection=true"
Dim CommandText As String = "select amat_nume_tiers,amat_nom_1 as nom,
AMAT_PRENOM as prénom from tamat"
DIM commande AS STRING
dim valeur as String=request.querystring("nom")
IF valeur<>"" then
commande =" where amat_nom_commune like '" & valeur & "%'"
end if
CommandText=CommandText & commande & " order by amat_nom_1"
Dim myConnection As New OleDbConnection
myConnection.ConnectionString=ConnectionString
myConnection.Open()
Dim myCommand As New OleDbCommand(CommandText, myConnection)
DataGrid1.DataSource =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
DataGrid1.DataBind()
End Sub
 
K

kchalla

Hi dibusi,

you try with the following code.

Sub DataGrid_Page(Sender As Object, e As DataGridPageChangedEventArgs)
DataGrid1.CurrentPageIndex = e.NewPageIndex
BindGrid()
End Sub

regards,
kchalla
 
D

dibusi

hi kchalla

i tried to put the code
Sub DataGrid_Page(Sender As Object, e As DataGridPageChangedEventArgs)
DataGrid1.CurrentPageIndex = e.NewPageIndex
BindGrid()
End Sub
it doesn't work eiher

yours sincerely
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top