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(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
string [] sarName = GetEmployeeName ((string) Request.QuerySt ring["Id"]);
CreateEmployeeR ecord(sarName);
lbEmployees.Val ue = FindNewEmployee (sarName);
Server.Transfer ("EmpDetail.asp x", false);
}
EmpDetail.aspx. cs (second page)
private void Page_Load(objec t sender, System.EventArg s e)
{
BuildEmployeeDe tail(Convert.To Int32(Request.F orm["lbEmployee s"]));
lbEmployees.Val ue = Request.Form["lbEmployee s"];
}
"Tom Carter" <tc********@hot mail.com> wrote in message
news:a4******** *************** ***@posting.goo gle.com...
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.IsPostBac k) {Server.Transfe r("secondpage.a spx");
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["someFormElemen tName"];
~~~~~~~~~~~~~
Tommie Carter
www.premiertechnology.com
--
"Jeremy Ames" <yo******@here. com> wrote in message
news:<#q******* *******@tk2msft ngp13.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?