0

I have a TreeView (in UserControl that is placed on SharePoint site) with lots of nodes. After user clicks on any of these nodes PostBack is called and page reloads to the same position (vertically). What I need is to page to be not scrolled to selected node, but stay on its top. I assume that by default TreeView cannot do any scroll action, so it could be SharePoint...

here's my code concerning the issue :

protected void Page_Load(object sender, EventArgs e)  
 {

 if (!IsPostBack)  
 {   
 Load_Tree(); TreeViewDeps.ExpandDepth = 1; }  
 }  

 protected void TreeView_OnSelectedNodeChanged(object sender, EventArgs e)   
 {  
 Search_TextBox.Text = "";   
LoadList(TreeViewDeps.SelectedNode.Value.ToString(), TreeViewDeps.SelectedNode.Text);    
} 

3
  • can you not just set the nodes SelectedIndex at that point within the postback by storing it's value in a Session also to be clear on what you are saying.. are you saying that you want it to not be on the last Selected Node after PostBack can you show your Page_Load code as well as the Selected_Node EventHandler
    – MethodMan
    Commented Apr 4, 2013 at 14:21
  • <code>protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Load_Tree(); TreeViewDeps.ExpandDepth = 1; } } protected void TreeView_OnSelectedNodeChanged(object sender, EventArgs e) { Search_TextBox.Text = ""; LoadList(TreeViewDeps.SelectedNode.Value.ToString(), TreeViewDeps.SelectedNode.Text); } </code> here's my code concerning the issue
    – Anton
    Commented Apr 5, 2013 at 7:52
  • word of advise when adding code add it to your original Question. Edit and post it there its too hard to read in the comments section
    – MethodMan
    Commented Apr 5, 2013 at 13:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.