473,378 Members | 1,580 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,378 software developers and data experts.

ViewState

How can I get to a page's ViewState from inside a business object ? I have a
reference to the calling page but the ViewState property of the Control
class is protected.

Is there something similar to HttpContext.Current.Session that allows a
business object to access the current Session ?
Nov 18 '05 #1
7 3010
> How can I get to a page's ViewState from inside a business object ? I have
a
reference to the calling page but the ViewState property of the Control
class is protected.
Accessing private members from one class to another can be done by means of
creating public properties and methods that make changes to private members
from the inside.
Is there something similar to HttpContext.Current.Session that allows a
business object to access the current Session ?
System.Web.HttpContext.Current.Session

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"JezB" <je*************@blueyonder.co.yk> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl... How can I get to a page's ViewState from inside a business object ? I have a reference to the calling page but the ViewState property of the Control
class is protected.

Is there something similar to HttpContext.Current.Session that allows a
business object to access the current Session ?

Nov 18 '05 #2
> How can I get to a page's ViewState from inside a business object ? I have
a
reference to the calling page but the ViewState property of the Control
class is protected.
Accessing private members from one class to another can be done by means of
creating public properties and methods that make changes to private members
from the inside.
Is there something similar to HttpContext.Current.Session that allows a
business object to access the current Session ?
System.Web.HttpContext.Current.Session

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"JezB" <je*************@blueyonder.co.yk> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl... How can I get to a page's ViewState from inside a business object ? I have a reference to the calling page but the ViewState property of the Control
class is protected.

Is there something similar to HttpContext.Current.Session that allows a
business object to access the current Session ?

Nov 18 '05 #3

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
How can I get to a page's ViewState from inside a business object ? I
have a
reference to the calling page but the ViewState property of the Control
class is protected.
Accessing private members from one class to another can be done by means

of creating public properties and methods that make changes to private members from the inside.
I may have to resort to that, tho its not my ideal solution.
Is there something similar to HttpContext.Current.Session that allows a
business object to access the current Session ?
System.Web.HttpContext.Current.Session


No that's the same thing ! I meant something SIMILAR to this that would let
me get at ViewState.
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"JezB" <je*************@blueyonder.co.yk> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...
How can I get to a page's ViewState from inside a business object ? I
have a
reference to the calling page but the ViewState property of the Control
class is protected.

Is there something similar to HttpContext.Current.Session that allows a
business object to access the current Session ?


Nov 18 '05 #4

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
How can I get to a page's ViewState from inside a business object ? I
have a
reference to the calling page but the ViewState property of the Control
class is protected.
Accessing private members from one class to another can be done by means

of creating public properties and methods that make changes to private members from the inside.
I may have to resort to that, tho its not my ideal solution.
Is there something similar to HttpContext.Current.Session that allows a
business object to access the current Session ?
System.Web.HttpContext.Current.Session


No that's the same thing ! I meant something SIMILAR to this that would let
me get at ViewState.
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"JezB" <je*************@blueyonder.co.yk> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...
How can I get to a page's ViewState from inside a business object ? I
have a
reference to the calling page but the ViewState property of the Control
class is protected.

Is there something similar to HttpContext.Current.Session that allows a
business object to access the current Session ?


Nov 18 '05 #5
Ah, sorry. It's early. That would be

CType(System.Web.HttpContext.Current.Handler, System.Web.UI.Page).ViewState
(VB.Net)

- or -

((System.Web.UI.Page) System.Web.HttpContext.Current.Handler).ViewState (C#)

Note that this only makes the Page ViewState available. Each Control in the
Page has its own ViewState as well.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"JezB" <je*************@blueyonder.co.yk> wrote in message
news:Ow**************@TK2MSFTNGP12.phx.gbl...

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
How can I get to a page's ViewState from inside a business object ? I
have
a
reference to the calling page but the ViewState property of the Control class is protected.


Accessing private members from one class to another can be done by means

of
creating public properties and methods that make changes to private

members
from the inside.


I may have to resort to that, tho its not my ideal solution.
Is there something similar to HttpContext.Current.Session that allows a business object to access the current Session ?


System.Web.HttpContext.Current.Session


No that's the same thing ! I meant something SIMILAR to this that would

let me get at ViewState.
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"JezB" <je*************@blueyonder.co.yk> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...
How can I get to a page's ViewState from inside a business object ? I

have
a
reference to the calling page but the ViewState property of the Control class is protected.

Is there something similar to HttpContext.Current.Session that allows a business object to access the current Session ?



Nov 18 '05 #6
ViewState is still inaccessible due to its protection level I'm afraid.

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
Ah, sorry. It's early. That would be

CType(System.Web.HttpContext.Current.Handler, System.Web.UI.Page).ViewState (VB.Net)

- or -

((System.Web.UI.Page) System.Web.HttpContext.Current.Handler).ViewState (C#)
Note that this only makes the Page ViewState available. Each Control in the Page has its own ViewState as well.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"JezB" <je*************@blueyonder.co.yk> wrote in message
news:Ow**************@TK2MSFTNGP12.phx.gbl...

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> How can I get to a page's ViewState from inside a business object ?
I
have
a
> reference to the calling page but the ViewState property of the Control > class is protected.

Accessing private members from one class to another can be done by
means of
creating public properties and methods that make changes to private members
from the inside.


I may have to resort to that, tho its not my ideal solution.

> Is there something similar to HttpContext.Current.Session that
allows a > business object to access the current Session ?

System.Web.HttpContext.Current.Session

No that's the same thing ! I meant something SIMILAR to this that would

let
me get at ViewState.
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"JezB" <je*************@blueyonder.co.yk> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...
> How can I get to a page's ViewState from inside a business object ?
I have
a
> reference to the calling page but the ViewState property of the

Control > class is protected.
>
> Is there something similar to HttpContext.Current.Session that
allows a > business object to access the current Session ?
>
>



Nov 18 '05 #7
Oh yes, that is correct. You would have to expose the ViewState via a public
property in the Page in order to access it from another class.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"JezB" <je*************@blueyonder.co.yk> wrote in message
news:OH**************@tk2msftngp13.phx.gbl...
ViewState is still inaccessible due to its protection level I'm afraid.

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
Ah, sorry. It's early. That would be

CType(System.Web.HttpContext.Current.Handler, System.Web.UI.Page).ViewState
(VB.Net)

- or -

((System.Web.UI.Page) System.Web.HttpContext.Current.Handler).ViewState

(C#)

Note that this only makes the Page ViewState available. Each Control in

the
Page has its own ViewState as well.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"JezB" <je*************@blueyonder.co.yk> wrote in message
news:Ow**************@TK2MSFTNGP12.phx.gbl...

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> > How can I get to a page's ViewState from inside a business object
? I have
> a
> > reference to the calling page but the ViewState property of the Control
> > class is protected.
>
> Accessing private members from one class to another can be done by means of
> creating public properties and methods that make changes to private
members
> from the inside.

I may have to resort to that, tho its not my ideal solution.

>
> > Is there something similar to HttpContext.Current.Session that allows
a
> > business object to access the current Session ?
>
> System.Web.HttpContext.Current.Session
>

No that's the same thing ! I meant something SIMILAR to this that
would let
me get at ViewState.

> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "JezB" <je*************@blueyonder.co.yk> wrote in message
> news:ud**************@TK2MSFTNGP09.phx.gbl...
> > How can I get to a page's ViewState from inside a business object

? I have
> a
> > reference to the calling page but the ViewState property of the

Control
> > class is protected.
> >
> > Is there something similar to HttpContext.Current.Session that

allows
a
> > business object to access the current Session ?
> >
> >
>
>



Nov 18 '05 #8

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

Similar topics

9
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
3
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event...
10
by: neo | last post by:
hi, I am studying ASP.NET and have few questions - 1) The session ID and values of controls is stored in VIEWSTATE variable. So now when we put EnableViewState="false" in Page directive and...
1
by: Simon | last post by:
Hi everyone, I have a quick question that I hope someone can help me with: I've made a user control that contains a text box and some validation functionality. This control has a few extra...
7
by: et | last post by:
I'm not sure I understand the use of the ViewState. Do I understand correctly that values of controls are automatically held in a hidden control called ViewState? If so, then why can't we get...
3
by: RCS | last post by:
I have an app that I have different "sections" that I want to switch back and forth from, all while having the server maintain viewstate for each page. In other words, when I am on Page1.aspx and...
9
by: Mark Broadbent | last post by:
Been a while since I've touched asp.net but one thing that always seems to fustrate me is the loss of state on variable declarations. Is there anyway (i.e. assigning an attribute etc) to instruct...
6
by: hitendra15 | last post by:
Hi I have created web user control which has Repeater control and Linkbutton in ItemTemplate of repeater control, following is the code for this control On first load it runs fine but when...
6
by: paul.hester | last post by:
Hi all, Does anyone know why the ViewState would be empty? When I'm receiving a postback, I can access a posted value using controlName.Value but not ViewState. I have EnableViewState set...
12
by: Nick C | last post by:
Hi How can i reduce the viewstate for my asp.net application. It is getting very large now. What is a good solution? thanks N
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.