Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
365
Strange behavior with row selection and template control
posted

I have a WebGrid that consist of two columns, one of which is a template control with a link button inside.  I also have row selection turned on.  When a user presses the link button I get a post back that fires the ItemCommand event where I remove the selected item from the list.  All of this works fine if the row being removed is the currently selected row.

However something strange happens if it is not the currently selected row.  After process all the way through PreRender it is as if a second request is occuring.  I find myself back in the onLoad event and processing the request again.  This time the only event fired is the row selection changed event.  The viewstate is back to having the original data, not the data with the removed item.  The request finishes and to the end user it appears that the row has not been removed.

I'm starting to believe this may have something to do with the way I unselect rows.  My page currently has two grid controls on it.  When one has a selected row, the other should not.  To unselect a row I loop through all the rows in the grid and set row.Selected and row.Activated to false.  Perhaps this is not the right way to unselect rows?

I don't understand why I am getting this second request.  If I turn off row selection, everthing works fine.  Has anyone seen this behavior before? Is there anyway to correct this?  Please help.