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
How to maintain WebTreeView scroll position on the postback caused by selected node.
Please answer.
OnNodeSelect client-side event of WebTreeView is used to collect the last position of the vertical scrollbar by obtaining the scrollTop property then store the value in HiddenField control. The OnNodeSelect client-side event specifies the client side (JavaScript) function name that will be invoked when node is selected. Parameters: (controlsId, node).
function WebTreeView1_OnNodeSelect(controlId, node) { // collecting the last position // of the vertical scrollbar // by obtaining the scrollTop property var treeView = ISGetObject(controlId); var frameElement = treeView.GetFrameElement(); // obtain the scrollTop property // of the vertical scrollbar var verticalPosition = frameElement.children[0].scrollTop; // store the value scrollTop position in HiddenField control form1.ValueHiddenField.value = verticalPosition; return true; }
Next, invoke the ApplyLatestScroll() JavaScript function from OnNodeSelectChanged event.
protected void WebTreeView1_NodeSelectChanged(object sender, ISNet.WebUI.WebTreeView.WebTreeViewNodeEventArgs e) { // This event fires after the selected treeview nodes are changed. // invoke ApplyLatestScroll() function to set back the scroll position. Page.ClientScript.RegisterStartupScript(this.GetType(), "ApplyLatestScroll", "ApplyLatestScroll();", true); }
The ApplyLatestScroll() JavaScript function is:
function ApplyLatestScroll() { // set back the previous scrollTop property or // vertical scroll position var treeView = ISGetObject("WebTreeView1"); var frameElement = treeView.GetFrameElement(); // manually configure the vertical scroll position frameElement.children[0].scrollTop = form1.ValueHiddenField.value; return true; }
I enclosed my simple sample for your reference. Please let me know whether this helps or not.
Hi Shailendra,
you could set the button function similiar to TreeView NodeSelect, for example:
function ApplyLatestScroll() { var treeView = ISGetObject("WebTreeView1"); var frameElement = treeView.GetFrameElement(); frameElement.children[0].scrollTop = form1.ValueHiddenField.value; return true; }
After that, invoke the ApplyLatestScroll() function from OnInitializeNode event.
protected void WebTreeView1_InitializeNode(object sender, ISNet.WebUI.WebTreeView.WebTreeViewNodeEventArgs e) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ApplyLatestScroll", "ApplyLatestScroll();", true); }
Hope this helps.
Best Regards,Erwin Sanders
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