473,761 Members | 9,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

server.transfer - access posted values after they r modified

P K
I am using server.transfer for a website being developed in vs.net 2005
And I need to get the posted values after server.transfer . For this I set
the second parameter "true" in the transfer method. Also enableViewState Mac
is made false in the destination page. Still I cannot get some changed values.

The scenario is such -
1. I have page 1 with a hidden variable named,"myHid" whose value is set to
"Text1"

2. When a submit happens on page1 to the same page, on page_load after
postback I do some database manipulations and then change the text of the
hidden variable to "Text2"
3. After this I do - server.transfer ("page2.aspx",t rue)
4. In page2.aspx on page load I try to access the hiddenvariable using
request.params( "myHid"). Doing this gives me the value "Text1". I do not get
the value "Text2".

Is this because in page_load just before transfer I modified the value and
by then the Post had already happened.
If so, what is the solution to access posted values even after they are
changed after postback.
Nov 19 '05 #1
2 1865
server transfer works by creating an instance of the new page and re-running
the page process logic with the new instance. the actual postback values in
the request are readonly. when you update a control (say your hidden), you
are updating it internal value, not the postback value.

if you want to access the value after update, on you original page supply
some public properties to return them, then access these from the
transferred page. the original page is accessed thru Context.Handler .

in asp.net 2.0, the code behinds are separate dll's, so you can not
reference them like in 1.0. this means you should create an interface with
the public properties that the page implements. the interface definition
should be in a file in the app_code directory.
-- bruce (sqlwork.com)


"P K" <P K@discussions.m icrosoft.com> wrote in message
news:E2******** *************** ***********@mic rosoft.com...
I am using server.transfer for a website being developed in vs.net 2005
And I need to get the posted values after server.transfer . For this I set
the second parameter "true" in the transfer method. Also
enableViewState Mac
is made false in the destination page. Still I cannot get some changed
values.

The scenario is such -
1. I have page 1 with a hidden variable named,"myHid" whose value is set
to
"Text1"

2. When a submit happens on page1 to the same page, on page_load after
postback I do some database manipulations and then change the text of the
hidden variable to "Text2"
3. After this I do - server.transfer ("page2.aspx",t rue)
4. In page2.aspx on page load I try to access the hiddenvariable using
request.params( "myHid"). Doing this gives me the value "Text1". I do not
get
the value "Text2".

Is this because in page_load just before transfer I modified the value and
by then the Post had already happened.
If so, what is the solution to access posted values even after they are
changed after postback.

Nov 19 '05 #2
P K
Hey Bruce,

Thanks for that one.Thats sounds sensible. Is there a complete working
example some where? I have got stuck while creating properties.

e.g.
'Protected myHid As System.Web.UI.W ebControls.Hidd enField
Public ReadOnly Property Hidden() As String
Get
Return Me.myHid.Value
End Get

If I do not declare the protected variable, while creating the dll for the
code behinds vbc does not recognize the myHid variable. If I uncomment it,
the aspx build fails saying that there already is a Protected myHid variable
on the page. ( I have it on the aspx page).

Some confusion there. A complete example would help.

P.K

"Bruce Barker" wrote:
server transfer works by creating an instance of the new page and re-running
the page process logic with the new instance. the actual postback values in
the request are readonly. when you update a control (say your hidden), you
are updating it internal value, not the postback value.

if you want to access the value after update, on you original page supply
some public properties to return them, then access these from the
transferred page. the original page is accessed thru Context.Handler .

in asp.net 2.0, the code behinds are separate dll's, so you can not
reference them like in 1.0. this means you should create an interface with
the public properties that the page implements. the interface definition
should be in a file in the app_code directory.
-- bruce (sqlwork.com)


"P K" <P K@discussions.m icrosoft.com> wrote in message
news:E2******** *************** ***********@mic rosoft.com...
I am using server.transfer for a website being developed in vs.net 2005
And I need to get the posted values after server.transfer . For this I set
the second parameter "true" in the transfer method. Also
enableViewState Mac
is made false in the destination page. Still I cannot get some changed
values.

The scenario is such -
1. I have page 1 with a hidden variable named,"myHid" whose value is set
to
"Text1"

2. When a submit happens on page1 to the same page, on page_load after
postback I do some database manipulations and then change the text of the
hidden variable to "Text2"
3. After this I do - server.transfer ("page2.aspx",t rue)
4. In page2.aspx on page load I try to access the hiddenvariable using
request.params( "myHid"). Doing this gives me the value "Text1". I do not
get
the value "Text2".

Is this because in page_load just before transfer I modified the value and
by then the Post had already happened.
If so, what is the solution to access posted values even after they are
changed after postback.


Nov 19 '05 #3

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

Similar topics

112
10355
by: Andy | last post by:
Hi All! We are doing new development for SQL Server 2000 and also moving from SQL 7.0 to SQL Server 2000. What are cons and pros for using IDENTITY property as PK in SQL SERVER 2000? Please, share your experience in using IDENTITY as PK .
5
7406
by: Tom | last post by:
Hi I am trying to transfer to a different .ASPX page using Server.Transfer. However, I get the following error: "Error executing child request for .aspx." Anyone know why? Thanks for help.
2
1525
by: Melissa | last post by:
I'm learning about Server.Transfer to see if it will be worthwhile so we can cut down on the number of session variables we use. And in doing a couple of tests following the .NET Framework SDK documentation (ms-help://MS.NETFrameworkSDKv1.1/cpguidenf/html/cpconpassingservercontrolva luesbetweenpages.htm), the example shows having the textbox controls as Protected, but when I tried to run the example and access the values in the text boxes...
7
6398
by: Tom wilson | last post by:
I'm trying to create dynamic controls in ASP.Net. It's driving me nuts. I keep getting the error: Control '16' of type 'RadioButton' must be placed inside a form tag with runat=server. Dim Place1 As New PlaceHolder Controls.Add(Place1) For y = 1 To Choices.RecordCount Choices.MoveTo(y)
1
2711
by: olduncleamos | last post by:
Hello all. With a background in ASP, I am finding the work required for passing values between pages mystifying. For various obvious reasons, I have eliminated using cookies and session to store state data. The only ASP.NET options left is to use the Server.Transfer to transfer to page 2 from page 1, and then use the context to get whatever values in page 1 from page 2. I do find this indeed a very elegant solution as now I can pass...
23
6809
by: barryfz | last post by:
I need to be able to move from one web app on my server to another on the same server and preserve the session state. I have played with server.transfer but I get an error saying I can't do this. How can I accomplish this. I don't think redirects with session state being passed in the url makes any sense from a security standpoint. -- Barry
15
4742
by: Marcus | last post by:
I created a VB.Net 1.1 application that iterates through all the tables in any basic Access 2000 database passed to it and generates the same table structure in a SQL Server Express database. The structure is created fine (with minor data conversions from one to the other, e.g. yes/no --> bit, memo --> text, etc). My problem now is transferring the data over from Access to SQL Server. I thought it would be a fairly straight forward...
2
7385
by: CCY | last post by:
Hi, Is there a way to convert GET/QueryString to POST/Form when transfer pages using Server.Transfer()? For example, 1. page 1 url: http://domain/page1.aspx?name1=value1 2. page 2 url: http://domain/page2.aspx
4
4017
by: evantay | last post by:
I'm using ASP.NET 2.0 with VS.NET 2005. I'm trying to access properties from my master pages within a page that inherits from that master page (a child page). However the values are always null. In my masterpage I have this: private bool m_AlreadyTested; public bool AlreadyTested { get { return m_AlreadyTested; }
0
9345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10115
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9905
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9775
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7332
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.