No, I am simply reloading the page, executing the stored procedure to return a subset of the original view and then databinding those results to the gridview. I use the gvUserList_RowDataBound event to tie up the checkboxes after the bind but even though it seems to all happen correctly in debug when my page is redisplayed it looks as though the checkboxes have picked up the values from the previous view, even though I have Enableviewstate="false" in the page directive, on the form, gridview, and controls themselves. Any idea what is happening?
pauliehaha
Posts
-
Gridview checkbox problems -
Gridview checkbox problemsHi, Thanks that's what I have
-
Gridview checkbox problemsHi, I have a gridview with a few bound fields and 2 checkboxes in template fields. I have some filter fields which go in a placeholder on the page e.g. Disabled and Deleted checkboxes When the user initially enters the stored procedure executes and returns the complete list. When a user checks disabled in the filter and hits submit the page reloads executes the stored procedure and returns the items that are disabled. My binding code is as follows:
daUserList.Fill(dtUserList) gvUserList.DataSource = dtUserList gvUserList.DataBind() Protected Sub gvUserList_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvUserList.RowDataBound Dim chkDisabled As CheckBox = CType(e.Row.FindControl("disabled"), CheckBox) Dim chkDeleted As CheckBox = CType(e.Row.FindControl("deleted"), CheckBox) Dim dataRow As DataRowView = e.Row.DataItem If dataRow IsNot Nothing Then chkDisabled.Checked = dataRow.Item("disabled") chkDeleted.Checked = dataRow.Item("deleted") End If End Sub
Now when the page first loads the checkboxes are populated correctly but when I submit filter options the page reloads with the new results but with checkbox values appearing as they did in the previous view. I've set EnableViewState="false" on the form, the gridview and the checkboxes but no joy. Also when I debug the checkboxes are being set correctly so it must be something that is happening after the RowDataBound event that is resetting the new checkboxes with values from the checkboxes in the previous full list. This is so frustrating, it's the last issue in my project, I've already spent a day on it and it's starting to make my project overrun! Please, can anyone shed any light on what is happening before I start going grey? Many Thanks, Paul The Website Shop