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
Hi,
I want to load the same no. of records, which are already loaded into the grid across grid refresh.
Scenario:
The default "VirtualPageSize" is 50 records, first time 50 records will be loaded bydefault, then as user click on "Load More Date" from webgrid taskbar, the no. of sets of 50 records will be added to the grid, if available.
Suppose I click 3 times on "Load More Data" them 3 sets of 50 records will be loaded to grid apart from the default 50 records, that is total 200 records are loaded.
Now if I select 110th record and perform some operation, the do the grid refresh, it should retain 200 records and it should retain the item selection.
To achieve this I want to store WebGrid1.VirtualLoadArgs.RequestedRows in WebGrid1_InitializeDataSource event when "Load More Data" icon is clicked from the grid taskbar, so next time when grid is refreshed, the same value I want to set the same value to e.Layout.VirtualPageSize in WebGrid1_InitializeLayout event.
I have tried using page local variable, hiddenfield, context, cookies etc, but nothing seems to working.
I am not able to hold the value and pass it across the WebGrid1_InitializeDataSource and WebGrid1_InitializeLayout events.
Please suggest as soon as possible.
Thanks and Regards
Apologize for the delay in sending this.
Please follow the step-by-step below in order to implement you required scenario.
<asp:HiddenField ID="HiddenField1" runat="server" />
function WebGrid1_OnBeforeRequest(controlId, action) { var WebGrid1 = ISGetObject(controlId); var hf = document.getElementById("HiddenField1"); if (action == "More") { if (hf.value != "") hf.value = parseInt(hf.value) + 10; else hf.value = WebGrid1.TotalLoadedRows + 10; } return true; }
protected void WebGrid1_InitializePostBack(object sender, PostbackEventArgs e) { if (HiddenField1.Value != "") { WebGrid1.LayoutSettings.VirtualPageSize = int.Parse(HiddenField1.Value); WebGrid1.VirtualLoadArgs.RequestedRows = int.Parse(HiddenField1.Value); } if (e.Action == "More") { WebGrid1.RebindDataSource(); ISNet.WebUI.FunctionParameter[] total = new ISNet.WebUI.FunctionParameter[1]; total[0] = new ISNet.WebUI.FunctionParameter(WebGrid1.VirtualLoadArgs.TotalDataSourceRows.ToString(), "string"); WebGrid1.ClientAction.InvokeScript("SetTotal", total); } else if (e.Action == "ColumnSort") { WebGrid1.RebindDataSource(); ISNet.WebUI.FunctionParameter[] total = new ISNet.WebUI.FunctionParameter[1]; total [0] = new ISNet.WebUI.FunctionParameter(WebGrid1.VirtualLoadArgs.TotalDataSourceRows.ToString(),"string"); WebGrid1.ClientAction.InvokeScript("SetTotal",total); } }
function WebGrid1_OnAfterResponseProcess(controlId, actionName, lastRequestObject, xmlResponseObject) { var WebGrid1 = ISGetObject(controlId); var hf = document.getElementById("HiddenField1"); var table = WebGrid1.RootTable; WebGrid1.TotalLoadedRows = hf.value; return true; }
function SetTotal(total) { var WebGrid1 = ISGetObject("WebGrid1"); var hf = document.getElementById("HiddenField1"); if (hf.value != "") WebGrid1.GetElement(WG40.STATUSBAR, WG40.HTMLROW).childNodes[3].innerText = "Loaded " + hf.value + " of " + total; }
A simple sample is enclosed as attachment. Please have the sample tested on your end and let us know whether this helps or not.
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