I bind a SQLDataSource to a GridView using GridView.DataBind() and these queries often take a significant time to execute.
What code would cancel an in-progress DataBind()?
I can’t seem to find any method to stop the DataBind() or even close the DB connection.
Rebind Attempt:
myConn.ConnectionsString = ""
myConn.SelectCommand = ""
myGrid.DataSource = Nothing
myGrid.DataBind()
Dispose Attempt
myConn.Dispose()
myGrid.Dispose()
Neither attempt actually closed the connection. Oracle still indicated it was still connected and executing the query.
You could manually bind the GridView and that would allow you to insert logic into the binding procedure to allow you to exit that procedure.
To do this subscribe to the onDataBinding event of the GridView.
You can read more about manually binding the GridView here: http://www.aarongoldenthal.com/post/2009/04/19/Manually-Databinding-a-GridView.aspx