473,322 Members | 1,408 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,322 software developers and data experts.

Changing forms

I am having problems with Server.Transfer when I try to change pages. I have
a page that I have created just to process the information from a previous
web form and then to go to the next page. The update routine puts a hidden
text box into the web form and populates it with an id from a database. When
I reach the next page, the id is not sent, and in fact the URL in the
address bar does not even change. Is there a better way for me to do this?
Nov 15 '05 #1
3 2195
Hi Jeremy,

A couple of quick insights on this will help I think. In the first
webform when you transfer the page then no other events on that page
will occur.. The indexChanged events (et.al) will not fire at this
point. So in your Page_Load routine for page one you could put in a
statement similar to this:

if (Page.IsPostBack) {Server.Transfer("secondpage.aspx");

If you read the data from page one and always transfer to page two
then page two will never be a postback (sans autopostback controls).
That is, if you are just displaying information from the first page
you will always be transferring to the page two as a new page (not a
postback).

In any case you can retrieve the information from the form elements on
the first page by adding something like this to page two:

string myvar_onpagetwo = Request.Form["someFormElementName"];

~~~~~~~~~~~~~
Tommie Carter
www.premiertechnology.com
--
"Jeremy Ames" <yo******@here.com> wrote in message news:<#q**************@tk2msftngp13.phx.gbl>...
I am having problems with Server.Transfer when I try to change pages. I have
a page that I have created just to process the information from a previous
web form and then to go to the next page. The update routine puts a hidden
text box into the web form and populates it with an id from a database. When
I reach the next page, the id is not sent, and in fact the URL in the
address bar does not even change. Is there a better way for me to do this?

Nov 15 '05 #2
Well I am posting the information on a blank form, then submitting the
server.transfer. The first page is just to update the database. The second
page shows the updated information. There should be no postback information
at all. I am reading the form collection of the request class. Here is my
code:

CreateEmployee.aspx.cs (first page)
private void Page_Load(object sender, System.EventArgs e)

{

// Put user code to initialize the page here

string [] sarName = GetEmployeeName((string) Request.QueryString["Id"]);

CreateEmployeeRecord(sarName);

lbEmployees.Value = FindNewEmployee(sarName);

Server.Transfer("EmpDetail.aspx", false);

}

EmpDetail.aspx.cs (second page)

private void Page_Load(object sender, System.EventArgs e)

{

BuildEmployeeDetail(Convert.ToInt32(Request.Form["lbEmployees"]));

lbEmployees.Value = Request.Form["lbEmployees"];

}
"Tom Carter" <tc********@hotmail.com> wrote in message
news:a4**************************@posting.google.c om...
Hi Jeremy,

A couple of quick insights on this will help I think. In the first
webform when you transfer the page then no other events on that page
will occur.. The indexChanged events (et.al) will not fire at this
point. So in your Page_Load routine for page one you could put in a
statement similar to this:

if (Page.IsPostBack) {Server.Transfer("secondpage.aspx");

If you read the data from page one and always transfer to page two
then page two will never be a postback (sans autopostback controls).
That is, if you are just displaying information from the first page
you will always be transferring to the page two as a new page (not a
postback).

In any case you can retrieve the information from the form elements on
the first page by adding something like this to page two:

string myvar_onpagetwo = Request.Form["someFormElementName"];

~~~~~~~~~~~~~
Tommie Carter
www.premiertechnology.com
--
"Jeremy Ames" <yo******@here.com> wrote in message
news:<#q**************@tk2msftngp13.phx.gbl>...
I am having problems with Server.Transfer when I try to change pages. I have a page that I have created just to process the information from a previous
web form and then to go to the next page. The update routine puts a hidden
text box into the web form and populates it with an id from a database. When I reach the next page, the id is not sent, and in fact the URL in the
address bar does not even change. Is there a better way for me to do this?

Nov 15 '05 #3
Jeremy,

Try substituting this line and see if you get the form values in
the second page. Also check the html being generated since all asp.net
does is generate html for your browser -- if anything is not correct
in the html then simply work backwards to identify the issue on the
asp side of the code.

Server.Transfer("EmpDetail.aspx");

~~~~~~~~~~~~~
Tommie Carter
www.premiertechnology.com
--
"Jeremy Ames" <yo******@here.com> wrote in message news:<ul**************@TK2MSFTNGP10.phx.gbl>...
Well I am posting the information on a blank form, then submitting the
server.transfer. The first page is just to update the database. The second
page shows the updated information. There should be no postback information
at all. I am reading the form collection of the request class. Here is my
code:

CreateEmployee.aspx.cs (first page)
private void Page_Load(object sender, System.EventArgs e)

{

// Put user code to initialize the page here

string [] sarName = GetEmployeeName((string) Request.QueryString["Id"]);

CreateEmployeeRecord(sarName);

lbEmployees.Value = FindNewEmployee(sarName);

Server.Transfer("EmpDetail.aspx", false);

}

EmpDetail.aspx.cs (second page)

private void Page_Load(object sender, System.EventArgs e)

{

BuildEmployeeDetail(Convert.ToInt32(Request.Form["lbEmployees"]));

lbEmployees.Value = Request.Form["lbEmployees"];

}
"Tom Carter" <tc********@hotmail.com> wrote in message
news:a4**************************@posting.google.c om...
Hi Jeremy,

A couple of quick insights on this will help I think. In the first
webform when you transfer the page then no other events on that page
will occur.. The indexChanged events (et.al) will not fire at this
point. So in your Page_Load routine for page one you could put in a
statement similar to this:

if (Page.IsPostBack) {Server.Transfer("secondpage.aspx");

If you read the data from page one and always transfer to page two
then page two will never be a postback (sans autopostback controls).
That is, if you are just displaying information from the first page
you will always be transferring to the page two as a new page (not a
postback).

In any case you can retrieve the information from the form elements on
the first page by adding something like this to page two:

string myvar_onpagetwo = Request.Form["someFormElementName"];

~~~~~~~~~~~~~
Tommie Carter
www.premiertechnology.com
--
"Jeremy Ames" <yo******@here.com> wrote in message
news:<#q**************@tk2msftngp13.phx.gbl>...
I am having problems with Server.Transfer when I try to change pages. I

have
a page that I have created just to process the information from a previous
web form and then to go to the next page. The update routine puts a hidden
text box into the web form and populates it with an id from a database.

When
I reach the next page, the id is not sent, and in fact the URL in the
address bar does not even change. Is there a better way for me to do this?

Nov 15 '05 #4

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

Similar topics

7
by: Stefan Finzel | last post by:
Hi, is there a way to change the display property on Windows Mobile 2003 SE Mobile/Pocket Internet Explorer? See following example. Please note: visibilty property has the same problem. Is...
10
by: Marizel | last post by:
I'm not sure there's an easy solution to this, but thought I'd ask. I often find myself with a query which I'd like to reuse, but with a different datasource. These datasources generally have...
2
by: S P Arif Sahari Wibowo | last post by:
Hi! Do you know how to put a form's Access-Visual-Basic-code that will force the form to be inserted, while the user has not type anything in the form, without changing focus, selection, etc.? ...
4
by: Tony W | last post by:
Hi, I am trying to write a simple application to retrieve data from the Windows registry and insert it into textboxs on a windows form. So far I have one namespace containing two classess. ...
2
by: Luca | last post by:
Hello, I'm using a windows form in which there is a standard ListBox control. I want to add/remove objects from the ArrayList associated to the ListBox, and I want the ListBox immediately shows...
7
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and...
32
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's...
1
by: DrJarmin | last post by:
Hello The problem is this: in the criteria for a list box I reference the parent form - and Access KEEPS changing the criteria for one that won't work. Details below: I have a couple of list...
3
by: jimatqsi | last post by:
I'm having trouble changing the focus from form to form. I've got a big form with two smaller forms. The main form takes the left 1/3 of the screen, subform1 the upper right, and subform2 the...
8
Megalog
by: Megalog | last post by:
Hey guys.. my turn to ask a question: I'm having a weird issue with a form I've reworked. This form has a combo box, which when used is changing the recordsource of a subform. This subform has...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.