CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 5/9/2005 1:13:22 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 26 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
kaanoezturk
Asp.Net User
A ViewState Question5/9/2005 1:13:22 PM

0/0

Hi,

When I save a value into the ViewState, can I get the value in another NamingContainer with the same key? Or is that value only accessible in the same NamingContainer?

For example:

I have an usercontrol U1, which contains another usercontrol U2. If I save a value into the Viewstate using:

// in U1.ascx.cs

ViewState["VALUE"] = aValue;

Then I cannot get it back with:

// in U2.ascx.cs

aValue = ViewState["VALUE"]  // it is null

 When I use ViewState["VALUE"], will the value searched only for the current NamingContainer or for the whole page?

KaaN

PLBlum
Asp.Net User
Re: A ViewState Question5/9/2005 9:20:43 PM

0/0

ViewState is a protected property of each Control.(Its defined in System.Web.UI.Control.)

When you interact with ViewState, you are always inside a particular control's scope and using its ViewState property. So when you say Naming container, you are referring to a control - the UserControl, the Page, etc.

Simply by knowing that ViewState is a protected property, you know that you cannot access it from outside of the control that owns it. In your case, that means one UserControl has its own ViewState that is not visible to any other.


--- Peter Blum
Creator of Professional Validation And More Suite, Peter's Date Package, and Peter's Polling Package
www.PeterBlum.com
BrockAllen
Asp.Net User
Re: A ViewState Question5/9/2005 10:58:23 PM

0/0

Each control gets its own "bucket" for ViewState and it's scoped based upon the position in the control hierarchy and its ID. So as long as the control hierarchy is the same upon postback, you shouldn't have to worry about controls getting mixed ViewState.

-Brock

 


DevelopMentor
http://staff.develop.com/ballen
kaanoezturk
Asp.Net User
Re: A ViewState Question5/10/2005 6:47:45 AM

0/0

Thank you for your clear answers!

I wanted to save a value for the page, which is accessible from all controls in the page. Now I am going to save it in the Context or in the Session.

KaaN

4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Pro C# 2008 and the .NET 3.5 Platform Authors: Andrew Troelsen, Pages: 1370, Published: 2007
ASP.NET Cookbook Authors: Michael A. Kittel, Michael A. Kittel Geoffrey T. LeBlond, Geoffrey T. LeBlond, Pages: 824, Published: 2004
Programming ASP.NET: Building Web Applications and Services with ASP.NET 2.0 Authors: Jesse Liberty, Dan Hurwitz, Pages: 930, Published: 2005
Beginning ASP.NET 2.0 AJAX: Written and Tested with the Final 1.0 Release Version of ASP.NET AJAX for ASP:NET 2.0 Authors: Wallace B. McClure, Paul Glavich, Scott Cate, Steve C. Orr, Craig Shoemaker, Steven A. Smith, Jim Zimmerman, Pages: 344, Published: 2007
MCAD Developing and Implementing Web Applications with Microsoft Visual C#(TM) . NET and Microsoft Visual Studio(R) . NET Exam Cram 2 (Exam Cram 70-315): Exam Cram 2, McAd Exam 70-315 Authors: Kirk Hausman, Amit Kalani, Ed Tittel, Pages: 600, Published: 2003
Expert ASP.NET 2.0 Advanced Application Design: Advanced Application Design Authors: Dominic Selly, Andrew Troelsen, Tom Barnaby, Pages: 459, Published: 2005
Learning C# 2005: Get Started with C# 2.0 and .NET Programming Authors: Jesse Liberty, Brian MacDonald, Pages: 528, Published: 2006
Pro VB 2005 and the .Net 2.0 Platform Authors: Andrew Troelsen, Pages: 1034, Published: 2006
Learning ASP.NET 3.5 Authors: Jesse Liberty, Dan Hurwitz, Brian MacDonald, Pages: 576, Published: 2008
Pro VB 2008 and the .NET 3.5 Platform Authors: Andrew Troelsen, Pages: 1377, Published: 2008

Web:
ViewState questions Talk about ViewState questions. ... ViewState questions. I'm not sure I understand the use of the ViewState. ...
Hottest "viewstate" Questions - Stack Overflow questions tagged. viewstate. sorted by hotness. Questions with the most recent interest and activity will appear first. See the complete list of tags. ...
Scott Hanselman's Computer Zen - ASP.NET Interview Questions Too much dependency on generic MSDN knowledge, too little of real problem solving questions. Postback and Viewstate questions are good since its fundamental ...
The Joel on Software Discussion Group - ASP.NET ViewState question Hi, I have a long going question about asp.net viewstate, where is the current value and previous value of TextBox stored? My guess: ...
Viewstate Question Talk about Viewstate Question. ... Viewstate Question. I'm constructing a link from a viewstate and passing it on to a querystring. ...
Request.QueryString and Viewstate question in Asp.net Hi Expert, I have a page show customer report. I have from date, end date and search button. After user click on search button, I get information from ...
viewstate and Firefox question - ASP.NET Forums Re: viewstate and Firefox question. 05-24-2007, 2:53 PM. Contact ... Re: viewstate and Firefox question. 05-24-2007, 3:19 PM. Contact ...
ASP.NET Newbie question about viewstate Newbie question about viewstate. Jerry Laudat posted at 18-Aug-06 02:33. Take the following 3 lines of code. The first two I'm beginning to understand. ...
what a viewstate expire - .NET ASP What do you want to say in your first question? "What" a viewstate expires? Or " When"? Well... there's no expiry to the viewstate. ...
ASP.NET Interview Questions - Can dataset be stored in a viewstate? Yes, a dataset may be stored in a viewstate. However, a viewstate is passed to the server as a hidden variable. Precaution should be taken that the dataset ...




Search This Site:










this type of page is not served

problem with download section using ssl

adding more user info

gotcommunitynet (general)

[1.2] - architecture - break down

private message

simple question (i think)

community service - section not displayed

validationexpression url allow http://xxx.xx?xx=x

compiler warnings

urgent:how to add tooltips on thread ico in gcn like it be in asp.net forum?

[1.2] - core engine

the cck project

portal download

onverting from csk to gcn

[2.0] planning and strategy

fxcop rules

c# imc

suggestion: post the code of the changes in the gcn

checked in: missing parameter when securing isp admin's password

ship date

book review: businding websites with the asp.net community starter kit

dir2aspx isapi filter

how to create a mod

domain.com/community1, domain.com/community2, etc.

questions on cbo.fillobject method

slight problem with logocell

named page security issue

webhost4life smtp

gcn rebuilt starting with forum ii code - a study on architecture

  Privacy | Contact Us
All Times Are GMT