Groups | Blog | Home
all groups > asp.net webcontrols > december 2005 >

asp.net webcontrols : Master Pages and Cross-Page Form Information


David R. Longnecker
12/27/2005 1:08:22 AM
I'm slowly learning the new caveats of master pages and ASP.NET 2.0 and, =
so far, really enjoying it. A couple of questions to help kickstart my =
mind from the old ASP3 days. From what I've found, 2.0's cross-page =
posting allows me to set a PostBackURL and then =
Request.Form["objectName"] the information into the next page. Okay, =
that works up until I use Master Pages for my central header/footers. =
Using the Master Pages, it appears nothing is past to the Postback page; =
however, an error is not generated.

For example, on page 1 (default.aspx):
--
<%@ Page Language=3D"C#" MasterPageFile=3D"~/MasterPage.master" =
AutoEventWireup=3D"true" CodeFile=3D"Default.aspx.cs" =
Inherits=3D"_Default" Title=3D"Untitled Page" %>

<asp:Content ID=3D"Content1" =
ContentPlaceHolderID=3D"ContentPlaceHolder1" Runat=3D"Server">

Stuff with post back:
<asp:TextBox ID=3D"TextBox1" runat=3D"server"></asp:TextBox>
<asp:Button ID=3D"Button1" runat=3D"server" =
PostBackUrl=3D"~/Step2.aspx" Text=3D"Button" />

</asp:Content>
--

Simple enough... on the PostBack page, I want to just read what was =
typed in that textbox.
--
<%@ Page Language=3D"C#" EnableViewStateMac=3D"false" =
MasterPageFile=3D"~/MasterPage.master" AutoEventWireup=3D"true" =
CodeFile=3D"Step2.aspx.cs" Inherits=3D"Step2" Title=3D"Untitled Page" %>

<asp:Content ID=3D"Content1" =
ContentPlaceHolderID=3D"ContentPlaceHolder1" Runat=3D"Server">

In step 1, you typed: <% Response.Write(Request.Form["TextBox1"]; %>

</asp:Content>
--

The master page consists of the default code:
--
<%@ Master Language=3D"C#" AutoEventWireup=3D"true" =
CodeFile=3D"MasterPage.master.cs" Inherits=3D"MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" =
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=3D"http://www.w3.org/1999/xhtml" >
<head runat=3D"server">
<title>Untitled Page</title>
</head>
<body>
<form id=3D"form1" runat=3D"server">
<div>
<asp:contentplaceholder id=3D"ContentPlaceHolder1" runat=3D"server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>
--

Is there something about the master page that I'm missing?

Any good references/resources to using master pages would also be =
appreciated. :) I have no trouble fishing for it, however, today, not =
only were the fish gone, but the pond was dry.

Thanks in advance!

-David
=20


-------------------------------------------------------------------------=
-
David R. Longnecker
CCNA, MCSA, Network+, A+
Management Information Services
Wichita Public Schools, USD 259=20
stcheng NO[at]SPAM online.microsoft.com
12/27/2005 9:18:43 AM
Hi David,

Welcome to MSDN newsgroup.
As for the querying TextBox values from Previous page when doing cross page
postback in asp.net 2.0, here are some of my understanding and suggestion:

1. the form values did exist in the Page.Request.Form collection. However,
since we're using Master page, the textboxes are cotained in the
ContentPlaceHolder which itself a child conttrol in the page's control
structure, so to avoid naming clash, the asp.net page will generate a
unique ID for all the child controsl in it (mangling their ID).... So we
can not use those Textboxs' original ID to query value from request.Form
collection. But we can printout them through the following code (to confirm
that they did exists..):
=====================
protected void Page_Load(object sender, EventArgs e)
{
if (PreviousPage != null && PreviousPage.IsCrossPagePostBack)
{

foreach (string key in Request.Form.Keys)
{
Response.Write("<br>" + key + ": " +Request.Form[key]);
}

}
}
====================


2. Actually the recommended means to retrieve Control property values in
Previous for cross page postback is defining some public Properties in the
Previous page's page class code which expose those certain controls'
property.... Then, we can use those Properties in the Target page's
code.... e.g:

Suppose we have two pages:


The first page is as below:
==========step1.aspx===========
<%@ Page Language="C#" MasterPageFile="~/CrossPost/TM.master"
AutoEventWireup="true" CodeFile="Step1.aspx.cs" Inherits="CrossPost_Step1"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
<asp:Button ID="btnCrossPost" runat="server"
PostBackUrl="~/CrossPost/Step2.aspx"
Text="Cross Post Back" />
</asp:Content>

And the codebehind is
==========step1.aspx.cs============
public partial class CrossPost_Step1 : System.Web.UI.Page
{
public string TextBox1Value
{
get
{
return TextBox1.Text;
}
}

public string TextBox2Value
{
get
{
return TextBox2.Text;
}
}


}



the target page (step2.aspx)'s aspx and codebehind:

=======step2.aspx============
<%@ Page Language="C#" MasterPageFile="~/CrossPost/TM.master"
AutoEventWireup="true" CodeFile="Step2.aspx.cs" Inherits="CrossPost_Step2"
Title="Untitled Page" %>
<%@ Reference Page="~/CrossPost/Step1.aspx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
</asp:Content>



=====step2.aspx.cs==========

protected void Page_Load(object sender, EventArgs e)
{
if (PreviousPage != null && PreviousPage.IsCrossPagePostBack)
{

CrossPost_Step1 page1 = PreviousPage as CrossPost_Step1;

if (page1 != null)
{
Response.Write("<br>" + page1.TextBox1Value);
Response.Write("<br>" + page1.TextBox2Value);
}

}
}

============================


Note that the below directive in the step2.aspx is very important:

<%@ Reference Page="~/CrossPost/Step1.aspx" %>


this indicate that we'll reference that page (~/CrossPost/Step1.aspx)'s
class or code in this page so that the asp.net runtime will compile them
into same assembly so as to make them visible to each other...............

Some additional resource:

http://www.asp.net/QuickStart/aspnet/doc/tipstricks/default.aspx#crosspage

http://msdn2.microsoft.com/en-us/library/ms178139.aspx

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)





--------------------
| From: "David R. Longnecker" <dlongnecker@community.nospam>
| Subject: Master Pages and Cross-Page Form Information
| Date: Tue, 27 Dec 2005 01:08:22 -0600
| Lines: 223
| MIME-Version: 1.0
| Content-Type: multipart/alternative;
| boundary="----=_NextPart_000_0034_01C60A82.08696930"
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <u9vaURrCGHA.336@TK2MSFTNGP14.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: ip24-255-143-36.ks.ks.cox.net 24.255.143.36
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:32036
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| I'm slowly learning the new caveats of master pages and ASP.NET 2.0 and,
so far, really enjoying it. A couple of questions to help kickstart my
mind from the old ASP3 days. From what I've found, 2.0's cross-page
posting allows me to set a PostBackURL and then Request.Form["objectName"]
the information into the next page. Okay, that works up until I use Master
Pages for my central header/footers. Using the Master Pages, it appears
nothing is past to the Postback page; however, an error is not generated.
| For example, on page 1 (default.aspx):
| --
| <%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"
Title="Untitled Page" %>
| <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
| Stuff with post back:
| <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
| <asp:Button ID="Button1" runat="server" PostBackUrl="~/Step2.aspx"
Text="Button" />
| </asp:Content>
| --
| Simple enough... on the PostBack page, I want to just read what was typed
in that textbox.
| --
| <%@ Page Language="C#" EnableViewStateMac="false"
MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="Step2.aspx.cs" Inherits="Step2" Title="Untitled Page" %>
| <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
| In step 1, you typed: <% Response.Write(Request.Form["TextBox1"]; %>
| </asp:Content>
| --
| The master page consists of the default code:
| --
| <%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml" >
| <head runat="server">
| <title>Untitled Page</title>
| </head>
| <body>
| <form id="form1" runat="server">
| <div>
stcheng NO[at]SPAM online.microsoft.com
12/29/2005 10:24:50 AM
Hi David,

Have you got the issue resolved or does my last reply helps you a little?
If there're anything else we can help, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 121575119
| References: <u9vaURrCGHA.336@TK2MSFTNGP14.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: stcheng@online.microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Tue, 27 Dec 2005 09:18:43 GMT
| Subject: RE: Master Pages and Cross-Page Form Information
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| Message-ID: <voh8NasCGHA.832@TK2MSFTNGXA02.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| Lines: 193
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:32037
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi David,
|
| Welcome to MSDN newsgroup.
| As for the querying TextBox values from Previous page when doing cross
page
| postback in asp.net 2.0, here are some of my understanding and suggestion:
|
| 1. the form values did exist in the Page.Request.Form collection.
However,
| since we're using Master page, the textboxes are cotained in the
| ContentPlaceHolder which itself a child conttrol in the page's control
| structure, so to avoid naming clash, the asp.net page will generate a
| unique ID for all the child controsl in it (mangling their ID).... So
we
| can not use those Textboxs' original ID to query value from request.Form
| collection. But we can printout them through the following code (to
confirm
| that they did exists..):
| =====================
| protected void Page_Load(object sender, EventArgs e)
| {
| if (PreviousPage != null && PreviousPage.IsCrossPagePostBack)
| {
|
| foreach (string key in Request.Form.Keys)
| {
| Response.Write("<br>" + key + ": "
+Request.Form[key]);
| }
|
| }
| }
| ====================
|
|
| 2. Actually the recommended means to retrieve Control property values in
| Previous for cross page postback is defining some public Properties in
the
| Previous page's page class code which expose those certain controls'
| property.... Then, we can use those Properties in the Target page's
| code.... e.g:
|
| Suppose we have two pages:
|
|
| The first page is as below:
| ==========step1.aspx===========
| <%@ Page Language="C#" MasterPageFile="~/CrossPost/TM.master"
| AutoEventWireup="true" CodeFile="Step1.aspx.cs"
Inherits="CrossPost_Step1"
| Title="Untitled Page" %>
| <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
| Runat="Server">
| <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
| <br />
| <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
| <asp:Button ID="btnCrossPost" runat="server"
| PostBackUrl="~/CrossPost/Step2.aspx"
| Text="Cross Post Back" />
| </asp:Content>
|
| And the codebehind is
| ==========step1.aspx.cs============
| public partial class CrossPost_Step1 : System.Web.UI.Page
| {
| public string TextBox1Value
| {
| get
| {
| return TextBox1.Text;
| }
| }
|
| public string TextBox2Value
| {
| get
| {
| return TextBox2.Text;
| }
| }
|
|
| }
|
|
|
| the target page (step2.aspx)'s aspx and codebehind:
|
| =======step2.aspx============
| <%@ Page Language="C#" MasterPageFile="~/CrossPost/TM.master"
| AutoEventWireup="true" CodeFile="Step2.aspx.cs"
Inherits="CrossPost_Step2"
| Title="Untitled Page" %>
| <%@ Reference Page="~/CrossPost/Step1.aspx" %>
| <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
| Runat="Server">
| </asp:Content>
|
|
|
| =====step2.aspx.cs==========
|
| protected void Page_Load(object sender, EventArgs e)
| {
| if (PreviousPage != null && PreviousPage.IsCrossPagePostBack)
| {
|
| CrossPost_Step1 page1 = PreviousPage as CrossPost_Step1;
|
| if (page1 != null)
| {
| Response.Write("<br>" + page1.TextBox1Value);
| Response.Write("<br>" + page1.TextBox2Value);
| }
|
| }
| }
|
| ============================
|
|
| Note that the below directive in the step2.aspx is very important:
|
| <%@ Reference Page="~/CrossPost/Step1.aspx" %>
|
|
| this indicate that we'll reference that page (~/CrossPost/Step1.aspx)'s
| class or code in this page so that the asp.net runtime will compile them
| into same assembly so as to make them visible to each other...............
|
| Some additional resource:
|
| http://www.asp.net/QuickStart/aspnet/doc/tipstricks/default.aspx#crosspage
|
| http://msdn2.microsoft.com/en-us/library/ms178139.aspx
|
| Regards,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
|
|
|
| --------------------
| | From: "David R. Longnecker" <dlongnecker@community.nospam>
| | Subject: Master Pages and Cross-Page Form Information
| | Date: Tue, 27 Dec 2005 01:08:22 -0600
| | Lines: 223
| | MIME-Version: 1.0
| | Content-Type: multipart/alternative;
| | boundary="----=_NextPart_000_0034_01C60A82.08696930"
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| | Message-ID: <u9vaURrCGHA.336@TK2MSFTNGP14.phx.gbl>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| | NNTP-Posting-Host: ip24-255-143-36.ks.ks.cox.net 24.255.143.36
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| | Xref: TK2MSFTNGXA02.phx.gbl
| microsoft.public.dotnet.framework.aspnet.webcontrols:32036
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| |
| | I'm slowly learning the new caveats of master pages and ASP.NET 2.0
and,
| so far, really enjoying it. A couple of questions to help kickstart my
| mind from the old ASP3 days. From what I've found, 2.0's cross-page
| posting allows me to set a PostBackURL and then
Request.Form["objectName"]
| the information into the next page. Okay, that works up until I use
Master
| Pages for my central header/footers. Using the Master Pages, it appears
David R. Longnecker
1/1/2006 5:52:30 PM
Steven-

From what I can tell it worked like a charm... battling a IDE issue right
now (VS 2005 locking up with "Visual Studio is Busy" that I'm working to
resolve right now); however, it seemed to work exactly like I needed.
Thanks for your help!

-David


--
David R. Longnecker
CCNA, MCSA, Network+, A+
Management Information Services
Wichita Public Schools, USD 259


[quoted text, click to view]
David R. Longnecker
1/2/2006 12:47:48 PM
Steven-

Okay, I do have a theory question. What happens if/when I need to move
through the web site non-linear? The Reference Page means that it has to go
sequentially; however, I can foresee times where I'd want to allow the user
to go back and forth along the steps. Can you still make the variables
public and call them or would I need to place the information into a session
each page hop, then do a verification on the final "step"?

Thanks!

-David

--
David R. Longnecker
CCNA, MCSA, Network+, A+
Management Information Services
Wichita Public Schools, USD 259


[quoted text, click to view]
stcheng NO[at]SPAM online.microsoft.com
1/3/2006 9:57:17 AM
Thanks for your response David,

If you want to record such a navigation path so that the user can move
forward or backward through that path... I think using SessionState will be
prefered. CrossPage posting only make sense when the original using http
post to submit to the second page, there're also many other navigation
scenarios like Response.Redirect, clientscript redirect.... So I think
use SessionState should be the better approach to record such info(when a
certain new page is navigated....)..

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| From: "David R. Longnecker" <dlongnecker@community.nospam>
| References: <u9vaURrCGHA.336@TK2MSFTNGP14.phx.gbl>
<voh8NasCGHA.832@TK2MSFTNGXA02.phx.gbl>
<41i6gIGDGHA.1240@TK2MSFTNGXA02.phx.gbl>
<Og##w5yDGHA.3528@TK2MSFTNGP12.phx.gbl>
| Subject: Re: Master Pages and Cross-Page Form Information
| Date: Mon, 2 Jan 2006 12:47:48 -0600
| Lines: 330
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Response
| Message-ID: <O11zqO#DGHA.1088@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: ip24-255-143-36.ks.ks.cox.net 24.255.143.36
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:32185
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Steven-
|
| Okay, I do have a theory question. What happens if/when I need to move
| through the web site non-linear? The Reference Page means that it has to
go
| sequentially; however, I can foresee times where I'd want to allow the
user
| to go back and forth along the steps. Can you still make the variables
| public and call them or would I need to place the information into a
session
| each page hop, then do a verification on the final "step"?
|
| Thanks!
|
| -David
|
| --
| David R. Longnecker
| CCNA, MCSA, Network+, A+
| Management Information Services
| Wichita Public Schools, USD 259
|
|
[quoted text, click to view]
| > Steven-
| >
| > From what I can tell it worked like a charm... battling a IDE issue
right
| > now (VS 2005 locking up with "Visual Studio is Busy" that I'm working
to
| > resolve right now); however, it seemed to work exactly like I needed.
| > Thanks for your help!
| >
| > -David
| >
| >
| > --
| > David R. Longnecker
| > CCNA, MCSA, Network+, A+
| > Management Information Services
| > Wichita Public Schools, USD 259
| >
| >
[quoted text, click to view]
| >> Hi David,
| >>
| >> Have you got the issue resolved or does my last reply helps you a
little?
| >> If there're anything else we can help, please feel free to post here.
| >>
| >> Regards,
| >>
| >> Steven Cheng
| >> Microsoft Online Support
| >>
| >> Get Secure! www.microsoft.com/security
| >> (This posting is provided "AS IS", with no warranties, and confers no
| >> rights.)
| >> --------------------
| >> | X-Tomcat-ID: 121575119
| >> | References: <u9vaURrCGHA.336@TK2MSFTNGP14.phx.gbl>
| >> | MIME-Version: 1.0
| >> | Content-Type: text/plain
| >> | Content-Transfer-Encoding: 7bit
| >> | From: stcheng@online.microsoft.com (Steven Cheng[MSFT])
| >> | Organization: Microsoft
| >> | Date: Tue, 27 Dec 2005 09:18:43 GMT
| >> | Subject: RE: Master Pages and Cross-Page Form Information
| >> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| >> | Message-ID: <voh8NasCGHA.832@TK2MSFTNGXA02.phx.gbl>
| >> | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| >> | Lines: 193
| >> | Path: TK2MSFTNGXA02.phx.gbl
| >> | Xref: TK2MSFTNGXA02.phx.gbl
| >> microsoft.public.dotnet.framework.aspnet.webcontrols:32037
| >> | NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
| >> |
| >> | Hi David,
| >> |
| >> | Welcome to MSDN newsgroup.
| >> | As for the querying TextBox values from Previous page when doing
cross
| >> page
| >> | postback in asp.net 2.0, here are some of my understanding and
| >> suggestion:
| >> |
| >> | 1. the form values did exist in the Page.Request.Form collection.
| >> However,
| >> | since we're using Master page, the textboxes are cotained in the
| >> | ContentPlaceHolder which itself a child conttrol in the page's
control
| >> | structure, so to avoid naming clash, the asp.net page will generate a
| >> | unique ID for all the child controsl in it (mangling their ID)....
So
| >> we
| >> | can not use those Textboxs' original ID to query value from
| >> request.Form
| >> | collection. But we can printout them through the following code (to
| >> confirm
| >> | that they did exists..):
| >> | =====================
| >> | protected void Page_Load(object sender, EventArgs e)
| >> | {
| >> | if (PreviousPage != null && PreviousPage.IsCrossPagePostBack)
| >> | {
| >> |
| >> | foreach (string key in Request.Form.Keys)
| >> | {
| >> | Response.Write("<br>" + key + ": "
| >> +Request.Form[key]);
| >> | }
| >> |
| >> | }
| >> | }
| >> | ====================
| >> |
| >> |
| >> | 2. Actually the recommended means to retrieve Control property
values
| >> in
| >> | Previous for cross page postback is defining some public Properties
in
| >> the
| >> | Previous page's page class code which expose those certain controls'
| >> | property.... Then, we can use those Properties in the Target page's
| >> | code.... e.g:
| >> |
| >> | Suppose we have two pages:
| >> |
| >> |
| >> | The first page is as below:
| >> | ==========step1.aspx===========
| >> | <%@ Page Language="C#" MasterPageFile="~/CrossPost/TM.master"
| >> | AutoEventWireup="true" CodeFile="Step1.aspx.cs"
| >> Inherits="CrossPost_Step1"
| >> | Title="Untitled Page" %>
| >> | <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
| >> | Runat="Server">
| >> | <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
| >> | <br />
| >> | <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
| >> | <asp:Button ID="btnCrossPost" runat="server"
| >> | PostBackUrl="~/CrossPost/Step2.aspx"
| >> | Text="Cross Post Back" />
| >> | </asp:Content>
| >> |
| >> | And the codebehind is
| >> | ==========step1.aspx.cs============
| >> | public partial class CrossPost_Step1 : System.Web.UI.Page
| >> | {
stcheng NO[at]SPAM online.microsoft.com
1/5/2006 9:53:06 AM
Hi David,

Does my further response helps? If anything else we can help, please feel
free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 278091478
| References: <u9vaURrCGHA.336@TK2MSFTNGP14.phx.gbl>
<voh8NasCGHA.832@TK2MSFTNGXA02.phx.gbl>
<41i6gIGDGHA.1240@TK2MSFTNGXA02.phx.gbl>
<Og##w5yDGHA.3528@TK2MSFTNGP12.phx.gbl>
<O11zqO#DGHA.1088@tk2msftngp13.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: stcheng@online.microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Tue, 03 Jan 2006 09:57:17 GMT
| Subject: Re: Master Pages and Cross-Page Form Information
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| Message-ID: <LYgcbwEEGHA.1240@TK2MSFTNGXA02.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| Lines: 343
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:32193
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Thanks for your response David,
|
| If you want to record such a navigation path so that the user can move
| forward or backward through that path... I think using SessionState will
be
| prefered. CrossPage posting only make sense when the original using http
| post to submit to the second page, there're also many other navigation
| scenarios like Response.Redirect, clientscript redirect.... So I think
| use SessionState should be the better approach to record such info(when a
| certain new page is navigated....)..
|
| Hope helps. Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
|
| --------------------
| | From: "David R. Longnecker" <dlongnecker@community.nospam>
| | References: <u9vaURrCGHA.336@TK2MSFTNGP14.phx.gbl>
| <voh8NasCGHA.832@TK2MSFTNGXA02.phx.gbl>
| <41i6gIGDGHA.1240@TK2MSFTNGXA02.phx.gbl>
| <Og##w5yDGHA.3528@TK2MSFTNGP12.phx.gbl>
| | Subject: Re: Master Pages and Cross-Page Form Information
| | Date: Mon, 2 Jan 2006 12:47:48 -0600
| | Lines: 330
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| | X-RFC2646: Format=Flowed; Response
| | Message-ID: <O11zqO#DGHA.1088@tk2msftngp13.phx.gbl>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| | NNTP-Posting-Host: ip24-255-143-36.ks.ks.cox.net 24.255.143.36
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| | Xref: TK2MSFTNGXA02.phx.gbl
| microsoft.public.dotnet.framework.aspnet.webcontrols:32185
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| |
| | Steven-
| |
| | Okay, I do have a theory question. What happens if/when I need to move
| | through the web site non-linear? The Reference Page means that it has
to
| go
| | sequentially; however, I can foresee times where I'd want to allow the
| user
| | to go back and forth along the steps. Can you still make the variables
| | public and call them or would I need to place the information into a
| session
| | each page hop, then do a verification on the final "step"?
| |
| | Thanks!
| |
| | -David
| |
| | --
| | David R. Longnecker
| | CCNA, MCSA, Network+, A+
| | Management Information Services
| | Wichita Public Schools, USD 259
| |
| |
[quoted text, click to view]
| | > Steven-
| | >
| | > From what I can tell it worked like a charm... battling a IDE issue
| right
| | > now (VS 2005 locking up with "Visual Studio is Busy" that I'm working
| to
| | > resolve right now); however, it seemed to work exactly like I needed.
| | > Thanks for your help!
| | >
| | > -David
| | >
| | >
| | > --
| | > David R. Longnecker
| | > CCNA, MCSA, Network+, A+
| | > Management Information Services
| | > Wichita Public Schools, USD 259
| | >
| | >
[quoted text, click to view]
| | >> Hi David,
| | >>
| | >> Have you got the issue resolved or does my last reply helps you a
| little?
| | >> If there're anything else we can help, please feel free to post here.
| | >>
| | >> Regards,
| | >>
| | >> Steven Cheng
| | >> Microsoft Online Support
| | >>
| | >> Get Secure! www.microsoft.com/security
| | >> (This posting is provided "AS IS", with no warranties, and confers no
| | >> rights.)
| | >> --------------------
| | >> | X-Tomcat-ID: 121575119
| | >> | References: <u9vaURrCGHA.336@TK2MSFTNGP14.phx.gbl>
| | >> | MIME-Version: 1.0
| | >> | Content-Type: text/plain
| | >> | Content-Transfer-Encoding: 7bit
| | >> | From: stcheng@online.microsoft.com (Steven Cheng[MSFT])
| | >> | Organization: Microsoft
| | >> | Date: Tue, 27 Dec 2005 09:18:43 GMT
| | >> | Subject: RE: Master Pages and Cross-Page Form Information
| | >> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| | >> | Message-ID: <voh8NasCGHA.832@TK2MSFTNGXA02.phx.gbl>
| | >> | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| | >> | Lines: 193
| | >> | Path: TK2MSFTNGXA02.phx.gbl
| | >> | Xref: TK2MSFTNGXA02.phx.gbl
| | >> microsoft.public.dotnet.framework.aspnet.webcontrols:32037
| | >> | NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
| | >> |
| | >> | Hi David,
| | >> |
| | >> | Welcome to MSDN newsgroup.
| | >> | As for the querying TextBox values from Previous page when doing
| cross
| | >> page
| | >> | postback in asp.net 2.0, here are some of my understanding and
| | >> suggestion:
| | >> |
| | >> | 1. the form values did exist in the Page.Request.Form collection.
| | >> However,
| | >> | since we're using Master page, the textboxes are cotained in the
| | >> | ContentPlaceHolder which itself a child conttrol in the page's
| control
| | >> | structure, so to avoid naming clash, the asp.net page will
generate a
| | >> | unique ID for all the child controsl in it (mangling their ID)....

| So
| | >> we
| | >> | can not use those Textboxs' original ID to query value from
| | >> request.Form
| | >> | collection. But we can printout them through the following code (to
| | >> confirm
| | >> | that they did exists..):
| | >> | =====================
| | >> | protected void Page_Load(object sender, EventArgs e)
| | >> | {
| | >> | if (PreviousPage != null &&
PreviousPage.IsCrossPagePostBack)
| | >> | {
| | >> |
David R. Longnecker
1/5/2006 4:37:14 PM
Steven-

Your response is great; I'm slowly working to change some of the current
page into a session state and will post if any problems arise. Thanks for
your help!

-David

[quoted text, click to view]
stcheng NO[at]SPAM online.microsoft.com
1/6/2006 1:52:30 AM
You're welcome Dave,

Good luck!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "David R. Longnecker" <dlongnecker@community.nospam>
| References: <u9vaURrCGHA.336@TK2MSFTNGP14.phx.gbl>
<voh8NasCGHA.832@TK2MSFTNGXA02.phx.gbl>
<41i6gIGDGHA.1240@TK2MSFTNGXA02.phx.gbl>
<Og##w5yDGHA.3528@TK2MSFTNGP12.phx.gbl>
<O11zqO#DGHA.1088@tk2msftngp13.phx.gbl>
<LYgcbwEEGHA.1240@TK2MSFTNGXA02.phx.gbl>
<dC4RZ3dEGHA.832@TK2MSFTNGXA02.phx.gbl>
| Subject: Re: Master Pages and Cross-Page Form Information
| Date: Thu, 5 Jan 2006 16:37:14 -0600
| Lines: 484
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#dzfYikEGHA.3092@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: ip24-255-143-36.ks.ks.cox.net 24.255.143.36
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:32270
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Steven-
|
| Your response is great; I'm slowly working to change some of the current
| page into a session state and will post if any problems arise. Thanks
for
| your help!
|
| -David
|
[quoted text, click to view]
| > Hi David,
| >
| > Does my further response helps? If anything else we can help, please
feel
| > free to post here.
| >
| > Regards,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | X-Tomcat-ID: 278091478
| > | References: <u9vaURrCGHA.336@TK2MSFTNGP14.phx.gbl>
| > <voh8NasCGHA.832@TK2MSFTNGXA02.phx.gbl>
| > <41i6gIGDGHA.1240@TK2MSFTNGXA02.phx.gbl>
| > <Og##w5yDGHA.3528@TK2MSFTNGP12.phx.gbl>
| > <O11zqO#DGHA.1088@tk2msftngp13.phx.gbl>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain
| > | Content-Transfer-Encoding: 7bit
| > | From: stcheng@online.microsoft.com (Steven Cheng[MSFT])
| > | Organization: Microsoft
| > | Date: Tue, 03 Jan 2006 09:57:17 GMT
| > | Subject: Re: Master Pages and Cross-Page Form Information
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | Message-ID: <LYgcbwEEGHA.1240@TK2MSFTNGXA02.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | Lines: 343
| > | Path: TK2MSFTNGXA02.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:32193
| > | NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
| > |
| > | Thanks for your response David,
| > |
| > | If you want to record such a navigation path so that the user can move
| > | forward or backward through that path... I think using SessionState
will
| > be
| > | prefered. CrossPage posting only make sense when the original using
http
| > | post to submit to the second page, there're also many other navigation
| > | scenarios like Response.Redirect, clientscript redirect.... So I
think
| > | use SessionState should be the better approach to record such
info(when
| > a
| > | certain new page is navigated....)..
| > |
| > | Hope helps. Thanks,
| > |
| > | Steven Cheng
| > | Microsoft Online Support
| > |
| > | Get Secure! www.microsoft.com/security
| > | (This posting is provided "AS IS", with no warranties, and confers no
| > | rights.)
| > |
| > |
| > |
| > | --------------------
| > | | From: "David R. Longnecker" <dlongnecker@community.nospam>
| > | | References: <u9vaURrCGHA.336@TK2MSFTNGP14.phx.gbl>
| > | <voh8NasCGHA.832@TK2MSFTNGXA02.phx.gbl>
| > | <41i6gIGDGHA.1240@TK2MSFTNGXA02.phx.gbl>
| > | <Og##w5yDGHA.3528@TK2MSFTNGP12.phx.gbl>
| > | | Subject: Re: Master Pages and Cross-Page Form Information
| > | | Date: Mon, 2 Jan 2006 12:47:48 -0600
| > | | Lines: 330
| > | | X-Priority: 3
| > | | X-MSMail-Priority: Normal
| > | | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| > | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| > | | X-RFC2646: Format=Flowed; Response
| > | | Message-ID: <O11zqO#DGHA.1088@tk2msftngp13.phx.gbl>
| > | | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | | NNTP-Posting-Host: ip24-255-143-36.ks.ks.cox.net 24.255.143.36
| > | | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | | Xref: TK2MSFTNGXA02.phx.gbl
| > | microsoft.public.dotnet.framework.aspnet.webcontrols:32185
| > | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | |
| > | | Steven-
| > | |
| > | | Okay, I do have a theory question. What happens if/when I need to
| > move
| > | | through the web site non-linear? The Reference Page means that it
has
| > to
| > | go
| > | | sequentially; however, I can foresee times where I'd want to allow
the
| > | user
| > | | to go back and forth along the steps. Can you still make the
| > variables
| > | | public and call them or would I need to place the information into a
| > | session
| > | | each page hop, then do a verification on the final "step"?
| > | |
| > | | Thanks!
| > | |
| > | | -David
| > | |
| > | | --
| > | | David R. Longnecker
| > | | CCNA, MCSA, Network+, A+
| > | | Management Information Services
| > | | Wichita Public Schools, USD 259
| > | |
| > | |
| > | | "David R. Longnecker" <dlongnecker@community.nospam> wrote in
message
| > | | news:Og%23%23w5yDGHA.3528@TK2MSFTNGP12.phx.gbl...
| > | | > Steven-
| > | | >
| > | | > From what I can tell it worked like a charm... battling a IDE
issue
| > | right
| > | | > now (VS 2005 locking up with "Visual Studio is Busy" that I'm
| > working
| > | to
| > | | > resolve right now); however, it seemed to work exactly like I
| > needed.
| > | | > Thanks for your help!
| > | | >
| > | | > -David
| > | | >
| > | | >
| > | | > --
| > | | > David R. Longnecker
| > | | > CCNA, MCSA, Network+, A+
| > | | > Management Information Services
| > | | > Wichita Public Schools, USD 259
| > | | >
| > | | >
| > | | > "Steven Cheng[MSFT]" <stcheng@online.microsoft.com> wrote in
message
| > | | > news:41i6gIGDGHA.1240@TK2MSFTNGXA02.phx.gbl...
| > | | >> Hi David,
| > | | >>
| > | | >> Have you got the issue resolved or does my last reply helps you a
| > | little?
| > | | >> If there're anything else we can help, please feel free to post
| > here.
| > | | >>
| > | | >> Regards,
| > | | >>
| > | | >> Steven Cheng
| > | | >> Microsoft Online Support
| > | | >>
AddThis Social Bookmark Button