472,958 Members | 2,682 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

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 enableViewStateMac
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",true)
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 1812
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.microsoft.com> wrote in message
news:E2**********************************@microsof t.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
enableViewStateMac
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",true)
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.WebControls.HiddenField
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.microsoft.com> wrote in message
news:E2**********************************@microsof t.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
enableViewStateMac
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",true)
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
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,...
5
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...
2
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...
7
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...
1
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...
23
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....
15
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...
2
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:...
4
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....
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.