[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

jimblizz [ms]

8/24/2003 10:43:00 PM

Where have you placed the code for example1 and example3? (during what
event processing?)

bliz
--
Jim Blizzard | http://weblogs.asp.net...
Sr .NET Developer Specialist
Microsoft

Your Potential. Our Passion.

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only, so that others may benefit. Thanks.


"Ryan" <ryanp@ungerboeck.com> wrote in message
news:5730157c.0308211559.51876687@posting.google.com...
> KEYWORDS: asp.net, mobile, hiddenvariables, hidden fields
>
> If i set a hidden variable as in example 1 on the intial page load...
> it is added to the page as you can see in example 2 (top of html
> source.)... on post back i cannont get the value back as in example
> 3... however as a quick solution example 4 works.
>
> CAN ANYONE help me out and explain this to me?
>
>
> EXAMPLE 1 --------------
> HiddenVariables("SessionID") = mstrSessionID
>
> EXAMPLE 2 --------------
> <html><body bgcolor="#E5EFFA">
> <form id="FormControl1" name="FormControl1" method="post"
> action="logm_p1_logon.aspx">
> <input type="hidden" name="__VIEWSTATE"
> value="aDxfX1A7QDw74peQ6IOJ5YGg4KOGLDA7Pjs+IRXdHoRGj8kRrVCr3EQgw1beeL4=">
> <input type="hidden" name="__EVENTTARGET" value=".">
> <input type="hidden" name="__EVENTARGUMENT" value="">
> <input type="hidden" name="__V_SessionID" value="ffzfcweikffn">
> <script language=javascript><!--
> function __doPostBack(target, argument){
> var theform = document.FormControl1
> theform.action = ""
> theform.__EVENTTARGET.value = target
> theform.__EVENTARGUMENT.value = argument
> theform.submit()
> }
> // -->
> </script>
>
> EXAMPLE 3 ----------------
> mstrSessionID = cstr(HiddenVariables("SessionID"))
>
> EXAMPLE 4 ----------------
> mstrSessionID = request("__V_SessionID")


3 Answers

ryanp

8/25/2003 1:31:00 PM

0

The line populating the value into the hiddenvariable sits at the
bottom of the page_load in the codebehind... and the line requesting
the data out of the hiddenvariable sits at the top of the page_load
(for use with a postback)

any help?
also can you be of help with any of my other posts? thanks.


"Jim Blizzard [MSFT]" <jimblizz@online.microsoft.com> wrote in message news:<3f493f5b$1@news.microsoft.com>...
> Where have you placed the code for example1 and example3? (during what
> event processing?)
>
> bliz
> --
> Jim Blizzard | http://weblogs.asp.net...
> Sr .NET Developer Specialist
> Microsoft
>
> Your Potential. Our Passion.
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Please reply to newsgroups only, so that others may benefit. Thanks.
>
>
> "Ryan" <ryanp@ungerboeck.com> wrote in message
> news:5730157c.0308211559.51876687@posting.google.com...
> > KEYWORDS: asp.net, mobile, hiddenvariables, hidden fields
> >
> > If i set a hidden variable as in example 1 on the intial page load...
> > it is added to the page as you can see in example 2 (top of html
> > source.)... on post back i cannont get the value back as in example
> > 3... however as a quick solution example 4 works.
> >
> > CAN ANYONE help me out and explain this to me?
> >
> >
> > EXAMPLE 1 --------------
> > HiddenVariables("SessionID") = mstrSessionID
> >
> > EXAMPLE 2 --------------
> > <html><body bgcolor="#E5EFFA">
> > <form id="FormControl1" name="FormControl1" method="post"
> > action="logm_p1_logon.aspx">
> > <input type="hidden" name="__VIEWSTATE"
> > value="aDxfX1A7QDw74peQ6IOJ5YGg4KOGLDA7Pjs+IRXdHoRGj8kRrVCr3EQgw1beeL4=">
> > <input type="hidden" name="__EVENTTARGET" value=".">
> > <input type="hidden" name="__EVENTARGUMENT" value="">
> > <input type="hidden" name="__V_SessionID" value="ffzfcweikffn">
> > <script language=javascript><!--
> > function __doPostBack(target, argument){
> > var theform = document.FormControl1
> > theform.action = ""
> > theform.__EVENTTARGET.value = target
> > theform.__EVENTARGUMENT.value = argument
> > theform.submit()
> > }
> > // -->
> > </script>
> >
> > EXAMPLE 3 ----------------
> > mstrSessionID = cstr(HiddenVariables("SessionID"))
> >
> > EXAMPLE 4 ----------------
> > mstrSessionID = request("__V_SessionID")

jimblizz

8/25/2003 5:29:00 PM

0

Hi Ryan,

Does your page_load look something like the following? (Yes, it''s
contrived, but the value is pulled out of the HiddenVariables on postback.)
When / where does your mstrSessionID get populated?

If it doesn''t look similar to this, can you post it to the newsgroup?

Dim mstrSessionID As String = "This is a test" '' <-- contrived

If Page.IsPostBack Then
mstrSessionID = CStr(HiddenVariables("SessionID"))
Label1.Text = mstrSessionID
Else
HiddenVariables("SessionID") = mstrSessionID
End If

Also, have you checked to make sure mstrSessionID has a value when you set
the HiddenVariables? Every ASP.NET page will have a "__VIEWSTATE" hidden
variable, even if you have viewstate disabled for the page. (Meaning that
just because you have a "__VIEWSTATE" hidden variable doesn''t mean you put
anything into it....

Thanks,
bliz
--
Jim Blizzard | http://weblogs.asp.net...
Sr .NET Developer Evangelist
Microsoft

Your Potential. Our Passion.

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only, so that others may benefit. Thanks.


--------------------
>From: ryanp@ungerboeck.com (Ryan)
>Newsgroups: microsoft.public.dotnet.framework.aspnet.mobile
>Subject: Re: HiddenVariables Issue
>Date: 25 Aug 2003 06:30:56 -0700
>
>The line populating the value into the hiddenvariable sits at the
>bottom of the page_load in the codebehind... and the line requesting
>the data out of the hiddenvariable sits at the top of the page_load
>(for use with a postback)
>
>any help?
>also can you be of help with any of my other posts? thanks.
>
>
>"Jim Blizzard [MSFT]" <jimblizz@online.microsoft.com> wrote in message
news:<3f493f5b$1@news.microsoft.com>...
>> Where have you placed the code for example1 and example3? (during what
>> event processing?)
>>
>> bliz
>> --
>> Jim Blizzard | http://weblogs.asp.net...
>> Sr .NET Developer Specialist
>> Microsoft
>>
>> Your Potential. Our Passion.
>>
>> This posting is provided "AS IS" with no warranties, and confers no
rights.
>> Please reply to newsgroups only, so that others may benefit. Thanks.
>>
>>
>> "Ryan" <ryanp@ungerboeck.com> wrote in message
>> news:5730157c.0308211559.51876687@posting.google.com...
>> > KEYWORDS: asp.net, mobile, hiddenvariables, hidden fields
>> >
>> > If i set a hidden variable as in example 1 on the intial page load...
>> > it is added to the page as you can see in example 2 (top of html
>> > source.)... on post back i cannont get the value back as in example
>> > 3... however as a quick solution example 4 works.
>> >
>> > CAN ANYONE help me out and explain this to me?
>> >
>> >
>> > EXAMPLE 1 --------------
>> > HiddenVariables("SessionID") = mstrSessionID
>> >
>> > EXAMPLE 2 --------------
>> > <html><body bgcolor="#E5EFFA">
>> > <form id="FormControl1" name="FormControl1" method="post"
>> > action="logm_p1_logon.aspx">
>> > <input type="hidden" name="__VIEWSTATE"
>> >
value="aDxfX1A7QDw74peQ6IOJ5YGg4KOGLDA7Pjs+IRXdHoRGj8kRrVCr3EQgw1beeL4=">
>> > <input type="hidden" name="__EVENTTARGET" value=".">
>> > <input type="hidden" name="__EVENTARGUMENT" value="">
>> > <input type="hidden" name="__V_SessionID" value="ffzfcweikffn">
>> > <script language=javascript><!--
>> > function __doPostBack(target, argument){
>> > var theform = document.FormControl1
>> > theform.action = ""
>> > theform.__EVENTTARGET.value = target
>> > theform.__EVENTARGUMENT.value = argument
>> > theform.submit()
>> > }
>> > // -->
>> > </script>
>> >
>> > EXAMPLE 3 ----------------
>> > mstrSessionID = cstr(HiddenVariables("SessionID"))
>> >
>> > EXAMPLE 4 ----------------
>> > mstrSessionID = request("__V_SessionID")
>

jimblizz

8/27/2003 5:31:00 AM

0

Hi Ryan,

Glad you were able to get it working. And thanks for posting the
resolution for everyone.

Later,
bliz

--
Jim Blizzard | http://weblogs.asp.net...
Sr .NET Developer Evangelist
Microsoft

Your Potential. Our Passion.

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only, so that others may benefit. Thanks.


--------------------
>From: ryanp@ungerboeck.com (Ryan)
>Newsgroups: microsoft.public.dotnet.framework.aspnet.mobile
>Subject: Re: HiddenVariables Issue
>Date: 25 Aug 2003 14:00:20 -0700
>
>My problem with HiddenVariables was present because I had the action
>attribute set in the form element... the attribute was set to the page
>name and was not treated as a postback..furthermore events (etc.) did
>not fire. Issue was resolved by taking the action tag out.
>