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
Let's say I select a row. Do a bunch of things (change page, etc.) and then want to display the grid and position back at the same page and same row.
We are using classic paging with 100 items on a page.
Your help is appreciated.
George,
Okay, I just realized that you're using OnTheFly configuration, which the Select in server-side may not be applicable (because the Grid wasn't refreshed in that case).
You can easily achieve this scenario by using ClientAction which maybe suitable in such OnTheFly context and for best performance. Here's how:
protected void WebGrid1_ButtonClick(object sender, ISNet.WebUI.WebGrid.ButtonEventArgs e) { SelectedObject selectedObject = WebGrid1.RetrieveClientLastSelectedObject() as SelectedObject; WebGrid1.ClientAction.InvokeScript("SelectRow", new FunctionParameter[] {new FunctionParameter((selectedObject.RowIndex + 1).ToString(), "number")}); }
Then in your ASPX, you have the following function in your scripts:
<script type="text/javascript"> function SelectRow(index) { var grid = ISGetObject("WebGrid1"); grid.RootTable.GetRow(index).Select(); } </script>
Thus, everytime the button is clicked, it'll select the row from the server-side call (which seamlessly call to the client-side to do the real operation). I have also attached a working sample for your convenience.
This is a much better solution instead of refreshing the entire Grid only to perform row selection which is very costly and results in slower response.
Hope this helps,James.
George, assuming that you keep the page index and the row value to be reselected, you can do the following.
To go to a specific page, use
grid.GotoPage(pageIndex);
To go to a specific row by key value (assuming the row existed in the page), you can use:
var row = grid.RootTable.GetRowByKeyValue("ALFKI"); if (row != null) row.Select();
James
I don't see this on the server side.
George
You can do the row selection from server-side, although not the paging for now.
For the row selection, use this:
grid.RootTable.Rows[index].Selected = true;
Let me know how it goes.
I'm not making progress. I tried your suggestion but the selected row is not selected on the client.
Here's what i tried.
created a gid with a button in column 1 that is used to select the row and a couple of columns of data.
Clicked a button and on the server side added 1 to the selected row index.
On the client side i expected the row below the one that i clicked to be selected. The ">" is still on the row that I clicked.
Code in button click looks like this
Dim Selection as SelectObject = WebGrid1.RetrieveClientLastSelectedObjecct()
WebGrid1.RootTables.Rows(Selection.RowIndex + 1).Selected = True
the grid button is autopostback onthefly so i've refreshed the WebGrid1 but there is no change in the selected row.
Do you have a sample? Thanks
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