Greetings,
I've been struggling with refreshing gridviews for a while now. My good buddy Google hasn't been able to solve this sucker for me. I'm using VB.NET 2.0 with ASP.NET.
I'm binding my gridviews like so:
I'm modifying rows that will appear in the gridview like so:
I've tried setting the EnableViewState to false in both the page and the gridview control, but that doesn't seem to work.
What is the best way to get the views to refresh without calling a Response.Redirect to reload the page.
Thanks for help.
"If it's stupid but works, it isn't stupid."
-Murphy's Military Laws
I've been struggling with refreshing gridviews for a while now. My good buddy Google hasn't been able to solve this sucker for me. I'm using VB.NET 2.0 with ASP.NET.
I'm binding my gridviews like so:
Code:
Private Sub get_events
Dim oleConn as New oleDbConnection(ConfigurationManager.ConnectionStrings("accdb").ConnectionString)
Dim oleCMD As New OleDbCommand
oleCMD.Connection = oleConn
Try
oleConn.Open
oleCMD.CommandText = "EXECUTE view_flaggedactgevents"
gvEvents.DataSource = oleCMD.ExecuteReader
gvEvents.DataBind
gvEvents.DataSource.Close
Catch ex As Exception
lblError.Text = ex.Message
Finally
oleConn.Close
End Try
End Sub
I'm modifying rows that will appear in the gridview like so:
Code:
Private Sub btnSubmit_Click(sender As object, e As EventArgs)
Dim intRowsAffected As Integer = 0
Dim oleConn As New OleDbConnection(ConfigurationManager.ConnectionStrings("accdb").ConnectionString)
Dim oleCMD As New OleDbCommand
oleCMD.Connection = oleConn
oleCMD.CommandText = "EXECUTE sproc_unflagevents"
Dim paramEventRowid As New OleDbParameter
With paramEventRowid
.ParameterName = "@eventrowid"
.OleDbType = OleDbType.Integer
End With
oleCMD.Parameters.Add(paramEventRowid)
Try
oleCOnn.Open
Dim dr As GridViewRow
For Each dr in gvEvents.Rows
If dr.RowType = DataControlRowType.DataRow Then
Dim chkbox As CheckBox
chkbox = dr.FindControl("chkItem")
If chkbox.Checked = True Then
paramEventRowid.Value = Integer.parse(gvEvents.DataKeys(dr.RowIndex)("actgevent_rowid"))
intRowsAffected += oleCMD.ExecuteNonQuery
End If
End If
Next dr
lblError.Text = intRowsAffected & " Events Unflagged"
'somehow refresh the gridview here
Catch ex As Exception
lblError.Text = ex.Message
Finally
oleConn.Close
End Try
End Sub
I've tried setting the EnableViewState to false in both the page and the gridview control, but that doesn't seem to work.
What is the best way to get the views to refresh without calling a Response.Redirect to reload the page.
Thanks for help.
"If it's stupid but works, it isn't stupid."
-Murphy's Military Laws