Data Adapter Binding Help

B

BG

I have a datagrid with paging. Using the following code, it loads data
initially as expected. When I click the next/previous buttons several times,
the table will eventually disappear. It's in the binding but I don't see it.
Any and all suggestions are welcome.

Thanks

G

Sub Page_Load

GetStats(MyIdentity)

End Sub

Sub GetStats(ByVal MyIdentity As String)

Try
Dim Myconnection As New OleDbConnection(connectionstring)
Myconnection.Open()

Dim objSocialAdapter As New OleDbDataAdapter
objSocialAdapter.TableMappings.Add("Table", _SOCIAL)
Dim CmdSocial As OleDbCommand = New OleDbCommand(SQL,
Myconnection)
CmdSocial.CommandType = CommandType.Text
objSocialAdapter.SelectCommand = CmdSocial
objSocialAdapter.Fill(objdset)

Myconnection.Close()

dgSocial.DataSource = objdset.Tables(_SOCIAL)

If Not IsPostBack Then
DataBind()
End If

Catch ex As SystemException

End Try

End Sub
 
J

John Saunders

BG said:
I have a datagrid with paging. Using the following code, it loads data
initially as expected. When I click the next/previous buttons several
times,
the table will eventually disappear. It's in the binding but I don't see
it.

In the PageChanged and Sort events, you have to reload your data and rebind
it to the DataGrid. Do this after you have changed the new page index.

John Saunders
 

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,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top