User Profile & Activity

Bob Elvin Member

Interesting, it doesn't work for us here. We're using IE11 so maybe that has something to do with it.

In the end I did find an alternate (and perhaps better) way to go about what I was trying to do. Using the OnRowSelect client event for the selection grid I trigger an update to the transaction grid. Accomplishes the same thing without having to refresh the whole page (and avoids this row selection bug).

Looks like the "insert code" feature didn't actually insert the code that I can see. I'll attach it as a zip.

I added your sample to the WebGridSamples project and ran it. It works fine as-is, it seems to correctly handle the row count after the postback.

However, note that your sample isn't checking something important. When multi-row selection is turned on but the user doesn't select multiple rows, they just select one, the GetCheckedRows() function doesn't return that row. To get the selected row you have to issue the single row selection function, SelectedRowKeyValue(), instead.

So, if you modify the PageLoad event in your sample to check for this situation, like I did with the attached code, it demonstrates the behaviour I've been seeing (that the first selected item is dropped from the display after the postback).


I took this a step further I made a tiny sample project to demonstrate my issue (which is attached). It has a grid and a text box that lists the selected rows.

If you look in the PageLoad event there's code to list the selected rows in the textbox. If that code is commented out the grid seems to work ok. Uncomment that code and the behaviour changes; clicking a range with shift+click no longer remembers the first selected row.

The PageLoad code doesn't try to affect the list of selected rows, it merely reports what the list is, but it seems that asking for the list actually causes the behaviour to change.


Thanks for your reply. I tried the same modifications to the MultipleRowSelection.aspx sample file that you described above (plus added some row highlighting styles to make them stand out more). On the first postback it does seem to retain all of the selected rows but if you keep playing with it after that first postback you'll notice it isn't working. You can't unselect any row no matter what you do and if you click the "Show Selected Rows" button that your sample has it says no rows are selected.

Attached are the modified version of the sample grid that I tried and a picture showing highlighted rows while also claiming that no rows are selected.

Thank you, that worked very well!

All times are GMT -5. The time now is 9:38 AM.
Previous Next