iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
I have a webgrid that's trying to use all these features at once:
The scenario is this grids acts as selection criteria for the user. Selecting a row should immediately return the search results for that row (hence the reason for the fullpagepostback) and selecting multiple rows should returns the results for multiple items.
The issue is around selecting multiple items. Selecting one row works great: the post back fires, the server-side code checks the selected items and retrieves data, and the results are displayed. Selecting multiple rows has a problem though, the grid looses track of the first selected row. For example selecting 3 rows with shift+left click causes the grid to only show 2 selected rows after the postback. Selecting individual rows with ctrl+left click causes previously selected rows to disappear.
The grid works fine if FullPagePostback is not turned on, it will select single rows or multiple rows without a problem. However, the users don't like hitting a Search button after making their selections and want it to happen automatically, hence the postback. Multiple row selection doesn't seem to get along with FullPagePostback though.
Is there a way to get this to work? I tried using the IsRowChecker column instead of selected rows but it still has the same issue with loosing track of which rows are selected during the postbacks.
Based on your information, I modified MultipleRowSelection.aspx sample file of WebGrid by applying following configuration:
Next, a breakpoint in Page_Load event is added. At this point, WebGrid1.RootTable.GetCheckedRows() is invoked to retrieve selected rows.
Selecting multiple rows has a problem though, the grid looses track of the first selected row. For example selecting 3 rows with shift+left click causes the grid to only show 2 selected rows after the postback. Selecting individual rows with ctrl+left click causes previously selected rows to disappear.
I tried to reproduce the problem in my local tests by selecting multiple rows using shift+left click or ctrl+left click but my efforts were not successful -- GetCheckedRows() returns correct number of selected rows.
Should you find anything that I might miss during my attempt to reproduce the reported problem, please feel free let me know.
Note: if necessary, I can provide you with the modified sample of MultipleRowSelection.aspx sample file of WebGrid.
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.
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.
I created a sample of WebGrid based on the code in WebForm1.aspx in the sent GridTest project. Please add my sample in WebGridSamples project and view the page in browser.
By using this sample, WebGrid is correctly shows selected rows when user clicking a range with Shift + click (from top row to bottom). However, problem happens when user clicking a range from bottom row to top using Shift + click or random click by holding Ctrl key.
I need your help to get more information regarding this problem before I forward this to WebGrid development team. Please feel free to let me know if you have different result or find another selection problem.
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).
Looks like the "insert code" feature didn't actually insert the code that I can see. I'll attach it as a zip.
I modified the code in Page_Load so it now looks like following:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim checkedRows As ArrayList = WebGrid1.RootTable.GetCheckedRows() txtSelectedRows.Visible = True Dim text As String = "Checked rows: " & checkedRows.Count & vbLf & vbLf For Each keyValue As String In checkedRows text &= keyValue & ";" Next keyValue If checkedRows.Count = 0 Then text = WebGrid1.SelectedRowKeyValue() End If txtSelectedRows.Text = text End Sub
Save the changes and view the page in browser. The first selected item is not dropped from the display after postback. Please check the attached video which taken when test the scenario.
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).
... We're using IE11 so maybe that has something to do with it.
For your information, I'm using WebGrid 9 rendered on IE11 browser.
... 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).
Glad to hear that the OnRowSelect suits your scenario.Should you need further assistance or run into any problems regarding our controls, feel free to post it into our forum. We would be happy to assist you again.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname