473,385 Members | 1,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 1842
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.