Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » .NET General

Post new topic   Reply to topic
Paging problem in datagrid
View previous topic :: View next topic  
Author Message
calvinkwoo3000
Newbie


Joined: 08 Feb 2006
Posts: 11

PostPosted: Mar 8th, 2006 01:23 AM    Post subject: Paging problem in datagrid Reply with quote

I have about 30 row data from database. I set the page size to 10.

It mean that i have 3 pages.

The datagrid have show me the number 1 , 2 , 3. after i click on the number 2 or 3

it stil shown me the 1st page.

And the bolded Public Sub below not function. Even i replace the binding to label1.text="something here".

May i know how to make the paging function?

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Binding()
End Sub
Public Sub MyDG_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyDG.SelectedIndexChanged

Binding()

End Sub

Public Function Binding()
Dim selectSQL As String
Dim con As SqlConnection
Dim configuration As String
Dim check As Boolean
Dim cmd As SqlCommand
Dim dataAdapter As SqlDataAdapter
Dim dataSet As DataSet
Dim reader As SqlDataReader

' MyDG.Visible = True
con = New SqlConnection("SERVER=(local);DATABASE=calvinflash;UID=sa;PWD=sa;")
con.Open()

selectSQL = "SELECT * FROM newpost ORDER BY postid DESC "
cmd = New SqlCommand(selectSQL, con)
dataAdapter = New SqlDataAdapter(cmd)
dataSet = New DataSet
dataAdapter.Fill(dataSet, "newpost")
con.Close()
MyDG.DataSource = dataSet.Tables("newpost")
MyDG.DataBind()
con.Dispose()
End Function
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » .NET General All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic