Cross Page Post Back When Using Mixture of Master Pages and Non-Master Pages

Discussion in 'ASP .Net' started by Jason@webbit.com, May 16, 2006.

  1. Guest

    I have page1.aspx that a user enters data in some form fields.
    Page1.aspx's form fields are placed within a Content Place Holder on
    the page and the page is using a Master Page. Page1.aspx posts to
    Page2.aspx, which doesn't use a Master Page at all - it's just a
    straight forward .aspx page. Problem is I can't seem to get the form
    field values from page1.aspx in use on page2.aspx. I've set up the
    PagePostBackURL attribute on the submit button on page1.aspx and have
    added the PreviousPageType directive along with the virtualpath
    attribute of it to page2.aspx. Help. How do I get the posted values
    from the first page?
     
    , May 16, 2006
    #1
    1. Advertising

  2. PeterKellner Guest

    On 16 May 2006 04:46:12 -0700, wrote:

    >I have page1.aspx that a user enters data in some form fields.
    >Page1.aspx's form fields are placed within a Content Place Holder on
    >the page and the page is using a Master Page. Page1.aspx posts to
    >Page2.aspx, which doesn't use a Master Page at all - it's just a
    >straight forward .aspx page. Problem is I can't seem to get the form
    >field values from page1.aspx in use on page2.aspx. I've set up the
    >PagePostBackURL attribute on the submit button on page1.aspx and have
    >added the PreviousPageType directive along with the virtualpath
    >attribute of it to page2.aspx. Help. How do I get the posted values
    >from the first page?


    I think you say you are pulling from a page that "has" a masterpage?
    If so, you need to reference the real control name which you can find
    by turning on trace in the page header.

    (Trace="true")

    Then, after you have the real field name, you can do something like
    this:

    Default sourcePage = (Default)PreviousPage;

    TextBox textBoxTargetWeight =
    sourcePage.FindControl("ctl00$ContentPlaceHolder1$TextBoxTargetWeight")
    as TextBox;

    Don't forget (like I did) the reference to your Default class in the
    Previous Page like this:

    <%@ PreviousPageType VirtualPath="~/Default.aspx" %>

    Good Luck,

    Peter Kellner
    http://peterkellner.net
    Peter Kellner
    http://peterkellner.net
     
    PeterKellner, May 16, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GBartgo

    gaussian mixture?

    GBartgo, Nov 1, 2003, in forum: C++
    Replies:
    2
    Views:
    508
    osmium
    Nov 2, 2003
  2. Sam
    Replies:
    1
    Views:
    805
  3. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    818
    Masudur
    May 25, 2007
  4. WebBuilder451

    cross page post back problem

    WebBuilder451, Apr 29, 2008, in forum: ASP .Net
    Replies:
    8
    Views:
    503
    WebBuilder451
    May 1, 2008
  5. WebBuilder451

    circular reference in cross page post back

    WebBuilder451, May 3, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    649
    WebBuilder451
    May 4, 2008
Loading...

Share This Page