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

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

  1. Jason

    Jason 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?
    Jason, May 16, 2006
    1. Advertisements

  2. Jason

    PeterKellner Guest

    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.


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

    Default sourcePage = (Default)PreviousPage;

    TextBox 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
    Peter Kellner
    PeterKellner, May 16, 2006
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.