473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Is ViwState Page-Specific or UserControl-Specific

Jav
ASP.Net 2.0 - using ObjectDataSources (Csla)

I sometimes have multiple Views (or Wizards) on a Page. Some of these may
have UserControls with Addresses or Phones in GridViews belonging to
different entities on the Page. My "entities" are stored in the Session
state. I save the Entity_id(Guid) of the entity whose addresses or phones
are in the GridView on the User Control in the ViewState using:
ViewState(Me.ID & "EntityID") = Entity_Id.toString (Me refers to the
UserControl)
This is done when the GridView is initially populated.

When the user moves from one Wizard page to another (or one View to
another), I retrieve the correct PhoneCollection or AddressCollection from
the Session based on the Entity_id which I retrieve from the ViewState using
CType(ViewState(Me.ID & "EntityID"), String)

It seems to work. However, 2 questions (concerns) linger on.
1. Do I even need to append Me.ID to Entity_ID since walking thru the
debugger, I am seeing that the 'ViewState' is specific to each User Control.
Is that a correct assumption?
2. If not, then Me.ID may not distinguish an Address UC on one View from one
on another View.

I would appreciate a suggestion or two.

Jav

Aug 16 '06 #1
2 1538
Hi,

every control has its own ViewState collection (instance of
System.Web.UI.StateBag) and essentially Page has its own also. Therefore,
you don't need to append the me.ID to EntityID when accessing ViewState
collection in a control.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Jav" <Ja*@discussions.microsoft.comwrote in message
news:DE**********************************@microsof t.com...
ASP.Net 2.0 - using ObjectDataSources (Csla)

I sometimes have multiple Views (or Wizards) on a Page. Some of these may
have UserControls with Addresses or Phones in GridViews belonging to
different entities on the Page. My "entities" are stored in the Session
state. I save the Entity_id(Guid) of the entity whose addresses or phones
are in the GridView on the User Control in the ViewState using:
ViewState(Me.ID & "EntityID") = Entity_Id.toString (Me refers to the
UserControl)
This is done when the GridView is initially populated.

When the user moves from one Wizard page to another (or one View to
another), I retrieve the correct PhoneCollection or AddressCollection from
the Session based on the Entity_id which I retrieve from the ViewState
using
CType(ViewState(Me.ID & "EntityID"), String)

It seems to work. However, 2 questions (concerns) linger on.
1. Do I even need to append Me.ID to Entity_ID since walking thru the
debugger, I am seeing that the 'ViewState' is specific to each User
Control.
Is that a correct assumption?
2. If not, then Me.ID may not distinguish an Address UC on one View from
one
on another View.

I would appreciate a suggestion or two.

Jav

Aug 16 '06 #2
Jav
Thanks Teemu
Jav

"Teemu Keiski" wrote:
Hi,

every control has its own ViewState collection (instance of
System.Web.UI.StateBag) and essentially Page has its own also. Therefore,
you don't need to append the me.ID to EntityID when accessing ViewState
collection in a control.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Jav" <Ja*@discussions.microsoft.comwrote in message
news:DE**********************************@microsof t.com...
ASP.Net 2.0 - using ObjectDataSources (Csla)

I sometimes have multiple Views (or Wizards) on a Page. Some of these may
have UserControls with Addresses or Phones in GridViews belonging to
different entities on the Page. My "entities" are stored in the Session
state. I save the Entity_id(Guid) of the entity whose addresses or phones
are in the GridView on the User Control in the ViewState using:
ViewState(Me.ID & "EntityID") = Entity_Id.toString (Me refers to the
UserControl)
This is done when the GridView is initially populated.

When the user moves from one Wizard page to another (or one View to
another), I retrieve the correct PhoneCollection or AddressCollection from
the Session based on the Entity_id which I retrieve from the ViewState
using
CType(ViewState(Me.ID & "EntityID"), String)

It seems to work. However, 2 questions (concerns) linger on.
1. Do I even need to append Me.ID to Entity_ID since walking thru the
debugger, I am seeing that the 'ViewState' is specific to each User
Control.
Is that a correct assumption?
2. If not, then Me.ID may not distinguish an Address UC on one View from
one
on another View.

I would appreciate a suggestion or two.

Jav


Aug 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael Brennan-White | last post by:
If I submit my for using a get action the resulting page loads . If I use a post action I get an error page saying "The page cannot be found". I am calling the originating page!!! This happens...
0
by: Nathan | last post by:
Hi, I seem to having a peculiar problem with the display of odd and even pages in XSL-FO. Here is a small background of the problem. My xsl stylesheet mentions my fo:layout-master-set as ...
2
by: James | last post by:
I've been to websites where if I navigate off a form, trying to get back to it by hitting the back button gives me a page which says "Warning, page has expired". It doesn't display the page. I've...
4
by: Kevin Phifer | last post by:
Ok, before anyone freaks out, I have a solution I need to create that gathers content from maybe different places. Each one can return a <form> in the html, so its the classic can't have more than...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
6
by: MooreSmnith | last post by:
When I navigate to the next page using Response.Rediect("MyNextPage.aspx") current page Page_Load event is called. What I may wrongly understood is that post back will happen whenever there is any...
1
by: Lenard Gunda | last post by:
Hi! I have the following problem. From my main page, when someone clicks a button, it uses client side javascript to open another .aspx page. This page displays content, based on what the...
7
by: UJ | last post by:
I've got a page with a user control on it. While the page is loading, it needs to check certain conditions of the user object to enable/disable things on the screen. Currently in the page_load of...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
8
by: Ed Jay | last post by:
I want to use history.go() to navigate between my previously loaded pages. I'm looking for a way to trigger a function call when a page is accessed using history.go(). Is there an event generated?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.