Treeview with scrollbar in asp.net
I puted treeview inside div so that I can scroll inside treeview but problem I am facing now that when I select particular node then scrollbar will move to top position instead of moving to the selected node position
So please help me to provide treeview with scrollbar with when user select any node then scroll bar should move to the s开发者_如何学运维elected node position.
Please note that I placed treeview inside update panel to avoid complete page postback on node selection and expand.
Add the MaintainScrollPositionOnPostback property to your page.
Rearrange your mark up page as follows:
-- Panel (scrollable).
--- Update panel (conditional)
---- Treeview
This mark up arrangement allows the panel (or div) scrollbar to be independent of any partial-page updates that happen in the tree view; furthermore, your panel does not participate in the partial-page updates thus the panel scrollbar position and dimensions do not change.
I resolved this by getting the the scrolltop value of the div that contain the treeview and set it back after the postback
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(ScrollUpB);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(ScrollUpE);
var scrollvalue;
function ScrollUpB() {
scrollvalue = $("#DivTreeview").scrollTop();
}
function ScrollUpE() {
$("#DivTreeview").scrollTop(scrollvalue);
}
精彩评论