Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 926727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:43:54+00:00 2026-05-15T19:43:54+00:00

Scratch this! I have googled my ass off looking for this. 1. Lets say

  • 0

Scratch this!

I have googled my ass off looking for this.
1. Lets say that i have a webform that has a few textboxes, with ID’s textbox1, textbox2, textbox3. They all have viewstate enabled.
I put some values in these textboxes and push a empty postback button and all the values are still there after postback. How can i access them in the viewstate after postback ?
I would think that they were saved under the ID name of the textboxes but i dont get it to work like so.
String s = ViewState[“textbox1”].ToString();
I’m trying to get this to work because I want to be able to save the viewstate into the session so i can retrieve the info after i visit another webform.
2. Isn’t it right that i can only use the viewstate on the same page that it was made on ?
I could not use the viewstate on default.aspx in editor.aspx ?
3. And one more thing, isnt it right that the viewstate saves how a treeview nodes are expended ? I would like save the state on the treeview between two webforms that use the same masterpage.


EDIT:

Ok, this wasn’t clear enough, thats a given.
Basicly i’m trying to understand the viewstate and what i can do with it.
I dont usually use viewstate to store values.

What i’m trying to do, or figure out if its possible with viewstate.

I have a masterpage and on the masterpage is a treeview. I have two pages that i use with the masterpage, Default.aspx and editor.aspx.
I do my navigations and everything in the Default.aspx. When i have expanded the nodes in the treeview and selected one of the treenode, the navigateurl on that treenode send me to editor.aspx?navID=3. The editor.aspx uses the same masterpage and i want that page to show the SAME state on the treeview as the Default.aspx did before i clicked on the node.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:43:55+00:00Added an answer on May 15, 2026 at 7:43 pm

    The Viewstate collection in System.Web.UI.Control only allows you to access the viewstate bag for that control, not child controls. So basically you can’t do what you want to do through ViewState.

    You can get the values that a control posted through the Request.Form parameters. For example, if you have a control call textbox1 you could get its posted value through

    Request.Form["textbox1"]  
    

    Depending on the control you may have to do some processing on the value you get out of there. For a treeview you can get the posted value of its expanded state using

    Request.Form[TreeView1.ClientID + "_ExpandState"]  
    

    The value is a string with either an e (expanded) or an n (not expanded) for each node. So if the value was “eennene”, nodes 1 2 5 and 7 would be expanded while the others would not be

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have few Core Data projects for MacOS started with Xcode 3 that behaves
I have this plan to create my own portfolio website and it has been
I'm creating a website from scratch and I was really into this in the
I'm trying to learn about trees by implementing one from scratch. In this case
I was looking at the Linux From Scratch project awhile ago and was sort
I have an application that stores large amount of files (XML and binary) in
I have 2 databases that have the same structure, one on a local machine
First off, this may be the wrong Forum for this question, as it's pretty
I have searched through google and SO for possible answers to this question, but
Before answering this question, understand that I am not asking how to create my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.