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.
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;"
objComm = New SqlCommand("pr_HolidaySales", objConn)
objComm.CommandType = CommandType.StoredProcedure
objComm.CommandTimeout = 500
GVHoliday.Visible = True
Open in New Window Select All
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!