Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>HTTP is what's known as a "<a href="http://en.wikipedia.org/wiki/Stateless_protocol" rel="nofollow">stateless protocol</a>". Basically, it's as if the server has a severe case of Alzheimer's disease (no disrespect intended). The server answers your query, but then forgets you were ever there.</p> <p>When HTTP was used primarily for fetching static documents, this posed no problem, but web applications require some kind of state. There are many ways this is accomplished, but ASP.NET typically makes heavy use of the "ViewState". The view state is simply an <code>&lt;input type="hidden"&gt;</code> tag which contains base-64 formatted byte code. (If you view the source of your rendered HTML page in the browser, you see it - named "__VIEWSTATE"). When the user resubmits the form (by clicking a button, etc), the viewstate data is sent back to server. Basically, it's like reminding the server about what it told you last time. This is how TextBoxes and GridViews are able to seemingly maintain their state between postbacks - they store their state in the "viewstate".</p> <p>The problem with the viewstate, though, is that it can be easily lost. You must submit the form or the viewstate will not be persisted. If you use an anchor tag or <code>Request.Redirect</code>, you are side-stepping the form and hitting a web page all on your own and, in the process, you are not passing any of the viewstate along.</p> <p>There is often no way to avoid this, so there are other ways to store your application's state. But, unlike the viewstate, this is something you must do manually for each and every value that you want to persist. You can store the data in a cookie, you can store the data on the server (using <code>Server["key"]</code> or <code>Session["key"]</code>) or you can persist the data in something more concrete, like a database or a text file. All of this must be done manually, however, and then you must reload the data when you reload the page.</p> <p>In your case, you may want to guess which item was selected based on the current page (since the treeview items and pages seem to be linked) and set the selected item explicitly. If that's not feasible, you could try storing the selected item in the <code>Session</code>, using something like <code>Session["Master_SelectedTreeViewItem"] = treeViewItem.Id;</code>. Then, in <code>Page_Load</code>, get this value (careful, it may be <code>null</code>) and then set the corresponding treeview item as selected.</p> <p>I would post more code examples, but you haven't provided the code where you are loading the treeview, etc, so it would be difficult to do.</p> <p><strong>Further Info</strong></p> <p><a href="http://msdn.microsoft.com/en-us/library/75x4ha6s.aspx" rel="nofollow">ASP.NET State Management Overview (MSDN)</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload