DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 20 Aug 2007 18:15:42 +0200,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Britt
          2    sloan
          3    Steve
          4    Aidy
          5    sloan
          6    Britt
          7    Peter Bromberg [C# MVP]
          8    Aleks Kleyn
          9    Steve
          10    Mark Rae [MVP]
          11    Steve


question about variable in session, viewstate ..   
Hi,

when uing session("myvar"), or viewstate("myvar") or cache("myvar), are the 
values always strings?
I mean:

dim dt as date
viewstate("test")=dt
.....
dt=vieswtate("test")

Does here occur a conversion first from date to string, then from string to 
date or the value remains always a date?


Thanks
Britt
Date:Mon, 20 Aug 2007 18:15:42 +0200   Author:  

Re: question about variable in session, viewstate ..   
You have to cast the object.


Employee e = new Employee();

viewstate("test")=e;


Employee anotherEmp = ViewState["test"] as Employee;

also, you may have to set the [Serializable] attribute for ViewState, and 
non In Proc Session usage.





"Britt"  wrote in message 
news:unxgeV04HHA.1212@TK2MSFTNGP05.phx.gbl...

> Hi,
>
> when uing session("myvar"), or viewstate("myvar") or cache("myvar), are 
> the values always strings?
> I mean:
>
> dim dt as date
> viewstate("test")=dt
> ....
> dt=vieswtate("test")
>
> Does here occur a conversion first from date to string, then from string 
> to date or the value remains always a date?
>
>
> Thanks
> Britt
> 
Date:Mon, 20 Aug 2007 12:30:24 -0400   Author:  

Re: question about variable in session, viewstate ..   
The values are of type "Object", so you can store just about anything in 
there. In your code, it's storing a Date object in ViewState since 
that's what you added in there.


Steve C.
MCAD,MCSE,MCP+I,CNE,CNA,CCNA


Britt wrote:

> Hi,
> 
> when uing session("myvar"), or viewstate("myvar") or cache("myvar), are the 
> values always strings?
> I mean:
> 
> dim dt as date
> viewstate("test")=dt
> .....
> dt=vieswtate("test")
> 
> Does here occur a conversion first from date to string, then from string to 
> date or the value remains always a date?
> 
> 
> Thanks
> Britt 
> 
> 
Date:Mon, 20 Aug 2007 12:30:59 -0400   Author:  

Re: question about variable in session, viewstate ..   

> are the  values always strings?


No, you can store anything in the session.


> Does here occur a conversion first from date to string, then from string 
> to date or the value remains always a date?


Not 100% on casting in VB, but there should be no conversion from string to 
date.
Date:Mon, 20 Aug 2007 17:32:53 +0100   Author:  

Re: question about variable in session, viewstate ..   
If you'd turn on

Option Explicit ON
Option Strict ON

You'd see this much earlier (that its an object).  And that you'd have to 
use some casting or convert function.


Convert.ToString ( ViewState("test") )

OR

ctype ( Employee , ViewState ("employeekey")



"Britt"  wrote in message 
news:unxgeV04HHA.1212@TK2MSFTNGP05.phx.gbl...

> Hi,
>
> when uing session("myvar"), or viewstate("myvar") or cache("myvar), are 
> the values always strings?
> I mean:
>
> dim dt as date
> viewstate("test")=dt
> ....
> dt=vieswtate("test")
>
> Does here occur a conversion first from date to string, then from string 
> to date or the value remains always a date?
>
>
> Thanks
> Britt
> 
Date:Mon, 20 Aug 2007 12:51:42 -0400   Author:  

Re: question about variable in session, viewstate ..   
Thanks to all

"sloan"  schreef in bericht 
news:%23tMyjp04HHA.4436@TK2MSFTNGP03.phx.gbl...

>
> If you'd turn on
>
> Option Explicit ON
> Option Strict ON
>
> You'd see this much earlier (that its an object).  And that you'd have to 
> use some casting or convert function.
>
>
> Convert.ToString ( ViewState("test") )
>
> OR
>
> ctype ( Employee , ViewState ("employeekey")
>
>
>
> "Britt"  wrote in message 
> news:unxgeV04HHA.1212@TK2MSFTNGP05.phx.gbl...
>> Hi,
>>
>> when uing session("myvar"), or viewstate("myvar") or cache("myvar), are 
>> the values always strings?
>> I mean:
>>
>> dim dt as date
>> viewstate("test")=dt
>> ....
>> dt=vieswtate("test")
>>
>> Does here occur a conversion first from date to string, then from string 
>> to date or the value remains always a date?
>>
>>
>> Thanks
>> Britt
>>
>
> 
Date:Mon, 20 Aug 2007 19:37:45 +0200   Author:  

Re: question about variable in session, viewstate ..   
Amen bro.
-- 
Recursion: see Recursion
site:  http://www.eggheadcafe.com
unBlog:  http://petesbloggerama.blogspot.com
BlogMetaFinder:    http://www.blogmetafinder.com



"sloan" wrote:


> 
> If you'd turn on
> 
> Option Explicit ON
> Option Strict ON
> 
> You'd see this much earlier (that its an object).  And that you'd have to 
> use some casting or convert function.
> 
> 
> Convert.ToString ( ViewState("test") )
> 
> OR
> 
> ctype ( Employee , ViewState ("employeekey")
> 
> 
> 
> "Britt"  wrote in message 
> news:unxgeV04HHA.1212@TK2MSFTNGP05.phx.gbl...
> > Hi,
> >
> > when uing session("myvar"), or viewstate("myvar") or cache("myvar), are 
> > the values always strings?
> > I mean:
> >
> > dim dt as date
> > viewstate("test")=dt
> > ....
> > dt=vieswtate("test")
> >
> > Does here occur a conversion first from date to string, then from string 
> > to date or the value remains always a date?
> >
> >
> > Thanks
> > Britt
> > 
> 
> 
> 
Date:Mon, 20 Aug 2007 13:02:03 -0700   Author:  

Re: question about variable in session, viewstate ..   
What is functionality of viewstate collection?

"Steve" wrote:


> The values are of type "Object", so you can store just about anything in 
> there. In your code, it's storing a Date object in ViewState since 
> that's what you added in there.
> 
> 
> Steve C.
> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
> 
> 
> Britt wrote:
> > Hi,
> > 
> > when uing session("myvar"), or viewstate("myvar") or cache("myvar), are the 
> > values always strings?
> > I mean:
> > 
> > dim dt as date
> > viewstate("test")=dt
> > .....
> > dt=vieswtate("test")
> > 
> > Does here occur a conversion first from date to string, then from string to 
> > date or the value remains always a date?
> > 
> > 
> > Thanks
> > Britt 
> > 
> > 
> 
Date:Tue, 21 Aug 2007 11:18:00 -0700   Author:  

Re: question about variable in session, viewstate ..   
That's a client-side caching mechanism, whereas SessionState is server 
side. ViewState is actually embedded in the HTML page (near the top), 
and is sent back and forth between the server and client. This is how it 
works. Other than that, they serve the same purpose. For "light" 
caching, ViewState works great, and there's virtually NO performance hit 
on the server. You just can't really store a LOT of data here because of 
how large the HTML page gets.


Steve C.
MCAD,MCSE,MCP+I,CNE,CNA,CCNA


Aleks Kleyn wrote:

> What is functionality of viewstate collection?
> 
> "Steve" wrote:
> 
>> The values are of type "Object", so you can store just about anything in 
>> there. In your code, it's storing a Date object in ViewState since 
>> that's what you added in there.
>>
>>
>> Steve C.
>> MCAD,MCSE,MCP+I,CNE,CNA,CCNA
>>
>>
>> Britt wrote:
>>> Hi,
>>>
>>> when uing session("myvar"), or viewstate("myvar") or cache("myvar), are the 
>>> values always strings?
>>> I mean:
>>>
>>> dim dt as date
>>> viewstate("test")=dt
>>> .....
>>> dt=vieswtate("test")
>>>
>>> Does here occur a conversion first from date to string, then from string to 
>>> date or the value remains always a date?
>>>
>>>
>>> Thanks
>>> Britt 
>>>
>>>
Date:Tue, 21 Aug 2007 14:27:32 -0400   Author:  

Re: question about variable in session, viewstate ..   
"Aleks Kleyn"  wrote in message 
news:337AE727-117F-4544-B05A-58246A8EE3DD@microsoft.com...


> What is functionality of viewstate collection?


Google is your friend:
http://www.google.co.uk/search?sourceid=navclient&aq=t&hl=en-GB&ie=UTF-8&rlz=1T4GGIH_en-GBGB220GB220&q=ViewState


-- 
Mark Rae
ASP.NET MVP
http://www.markrae.net
Date:Tue, 21 Aug 2007 19:29:28 +0100   Author:  

Re: question about variable in session, viewstate ..   
So are experienced developers. :)


Steve C.
MCAD,MCSE,MCP+I,CNE,CNA,CCNA


Mark Rae [MVP] wrote:

> "Aleks Kleyn"  wrote in message 
> news:337AE727-117F-4544-B05A-58246A8EE3DD@microsoft.com...
> 
>> What is functionality of viewstate collection?
> 
> Google is your friend:
> http://www.google.co.uk/search?sourceid=navclient&aq=t&hl=en-GB&ie=UTF-8&rlz=1T4GGIH_en-GBGB220GB220&q=ViewState 
> 
> 
> 
Date:Tue, 21 Aug 2007 14:32:16 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us