I added a sqldatasource from my toolbox to my aspx page. I then configured the sqldatasource to connect to a table. I then added a gridview to the same aspx page and selected the sqldatasource as it's data source. In addition to other column formatting etc., I set paging to true. I then opened the page in my browser, clicked the button I have on the page to display the gridview's data. However, when I click page 2 the gridview dissapears.
I then tried another approach, I added the table directly from the Server Explorer, configured the defaulted SQLDataSource connection, I set paging to true. I then opened the page in my browser, clicked the button I have on the page to display the gridview's data(see new code snippet). However, when I click page 2 the gridview dissapears.
That is the problem I'm having. The gridview keeps disappearing when I click a page number. There’s definitely more data to see. I'm sure there's a solution. I thought I just set the paging to true. But obviously it's not that simple. (see code snippet below).
Thanks for anyone's suppout.
BUTTON CODE:
Protected Sub btn_All_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_All.Click
Dim objConn As Data.SqlClient.SqlConnection
Dim objComm As Data.SqlClient.SqlCommand
objConn = New SqlClient.SqlConnection
objConn.ConnectionString = "Data Source=CODA2K;Persist Security Info=True;password=codaprod; USER ID=codaprod;Initial Catalog=CODAPROD;"
objConn.Open()
objComm = New SqlCommand("pr_HolidaySales", objConn)
objComm.CommandType = CommandType.StoredProcedure
objComm.CommandTimeout = 500
objComm.ExecuteNonQuery()
GVHoliday.DataBind()
GVHoliday.Visible = True
End Sub
Open in New Window Select All
Software/Hardware used:
ASKED:
February 5, 2009 5:25 PM
UPDATED:
July 21, 2009 12:14 AM