Datagrid problems

A

ASP.NET_Klown

I have a DataGrid with sorting and paging that shows a query from a stored
procedure on a "QueryPage."
The datagrid has a templatecolumn with an Image. The Image function as a
link for each record pulled from the database.
Each link (with different querystring parameters) sends the user to a
resultpage.
This works fine, but when I on the Resultpage press the "Back" button in IE
or right click the page and choose "Back",
the querypage crashes. Error message: "The Page cannot be displayed"

Is it possible to return to the Querypage with the Query intact?
Could someone be kind enough to give me a hint?

My code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
dbGrid.DataBind()
End If
End Sub

Sub dbGrid_PageIndexChanged(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridPageChangedEventArgs)
dbGrid.CurrentPageIndex = e.NewPageIndex
BindData()
End Sub

Sub BindData()
Dim dt As DataTable
Dim dr As DataRow
dt = New DataTable()
dt.Columns.Add(New DataColumn("var1", GetType(Integer)))
dt.Columns.Add(New DataColumn("var2", GetType(Integer)))
dt.Columns.Add(New DataColumn("var3", GetType(String)))
Dim mySqlConn As SqlConnection = New
SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim MySqlCmd As SqlCommand = New SqlCommand("proc_Procedure",
mySqlConn)
MySqlCmd.CommandType = CommandType.StoredProcedure

Try
mySqlConn.Open()
Dim Reader7 As SqlDataReader = MySqlCmd.ExecuteReader()
While Reader7.Read()
dr = dt.NewRow()
dr(0) = Reader7("var1")
dr(1) = Reader7("var2")
dr(2) = Reader7("var3")
dt.Rows.Add(dr)
End While
Reader7.Close()
mySqlConn.Close()
Catch f As SqlException
Dim trouble As New Err.errorHandling()
trouble.writeLogFile(f.Message)
End Try
dbGrid.DataSource = New DataView(dt)
dbGrid.DataBind()
END
 

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,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top