By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,592 Members | 1,977 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,592 IT Pros & Developers. It's quick & easy.

ViewState

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
> 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

P: n/a
> 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

P: n/a

"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

P: n/a

"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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.