2 Forms on one page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Benjamin Bittner

    2 Forms on one page

    Hi all
    I have a to different input masks on one page. The first must be posted on
    itself, the second must be posted to another website and popup in a new
    window. My problem is, ive got one global form tag (index.aspx). The content
    comes from different user controls. The two input masks come from 2
    different user controls. My global form tag encloses everything between the
    <body>-tags. So what i have to do imho, is to identificate which
    submit-button was clicked, and change the form attributes. So i have to
    change form attributes after a button was clicked, but before the form gets
    posted.

    Regards Benjamin


  • Scott Allen

    #2
    Re: 2 Forms on one page

    Hi Benjamin,

    The following article might provide some insight:

    Form-based Programming in ASP.NET
    Gain technical skills through documentation and training, earn certifications and connect with the community


    HTH,

    --
    Scott


    On Mon, 24 May 2004 09:37:49 +0200, "Benjamin Bittner"
    <benjamin_bittn er[a_t]nospam.web.de> wrote:
    [color=blue]
    >Hi all
    >I have a to different input masks on one page. The first must be posted on
    >itself, the second must be posted to another website and popup in a new
    >window. My problem is, ive got one global form tag (index.aspx). The content
    >comes from different user controls. The two input masks come from 2
    >different user controls. My global form tag encloses everything between the
    ><body>-tags. So what i have to do imho, is to identificate which
    >submit-button was clicked, and change the form attributes. So i have to
    >change form attributes after a button was clicked, but before the form gets
    >posted.
    >
    >Regards Benjamin
    >[/color]

    Comment

    • Philipp Ott

      #3
      Re: 2 Forms on one page

      Hi!

      Scott Allen wrote:[color=blue]
      > [...]
      > Form-based Programming in ASP.NET
      > http://msdn.microsoft.com/msdnmag/is...e/default.aspx
      > [...]
      > <benjamin_bittn er[a_t]nospam.web.de> wrote:[color=green]
      >>[..]
      >>change form attributes after a button was clicked, but before the form gets
      >>posted.
      >>
      >>Regards Benjamin[/color][/color]

      Hum but even this doc leaves a great many questions open.

      Imagine a typical invoice/order webform which has many buttons to add
      remove change items, change the address of the client, recipient address
      and payment stuff. This webform is part of an application with 20 other
      larger webforms to create address records, items, payments and billing
      stuffs etc.

      Such an invoice form has many buttons and some of them lead back to the
      same form with the same form variables and some lead to other forms,
      also with the form variables.

      How to make this in SFI ASP.NET?

      I m thinking of another solution, but then my question is:

      How can I upon receipt of a pressed button event change the whole
      "current page/webform context" to another webform and paste my current
      scope of form variables to the other webform, which then runs through
      its page creation render termination lifecycle? Or because it is already
      just fine living in memory simply forward the request there?


      Then when somebody presses a button on the invoice form which requires a
      redraw of the invoice form it is fine as usual. But when a button is
      pressed which leads to another webform, then .... what? Redirect the
      webbrowser to another form with a quazillion bytes long URL? Or can this
      happen "in memory", on the Server?

      Regards,
      Philipp

      Comment

      • Jason DeFontes

        #4
        Re: 2 Forms on one page

        Server.Transfer (string path, bool preserveForm)

        Terminates execution of the current page and begins execution of a new
        page using the specified URL path to the page. Specifies whether to
        clear the QueryString and Form collections.

        Parameters

        path -The URL path of the new page on the server to execute.

        preserveForm - If true, the QueryString and Form collections are
        preserved. If false, they are cleared. The default is false .

        -Jason

        Philipp Ott wrote:
        [color=blue]
        > Hi!
        >
        > Scott Allen wrote:
        >[color=green]
        >> [...]
        >> Form-based Programming in ASP.NET
        >> http://msdn.microsoft.com/msdnmag/is...e/default.aspx
        >> [...]
        >> <benjamin_bittn er[a_t]nospam.web.de> wrote:
        >>[color=darkred]
        >>> [..]
        >>> change form attributes after a button was clicked, but before the
        >>> form gets
        >>> posted.
        >>>
        >>> Regards Benjamin[/color][/color]
        >
        >
        > Hum but even this doc leaves a great many questions open.
        >
        > Imagine a typical invoice/order webform which has many buttons to add
        > remove change items, change the address of the client, recipient address
        > and payment stuff. This webform is part of an application with 20 other
        > larger webforms to create address records, items, payments and billing
        > stuffs etc.
        >
        > Such an invoice form has many buttons and some of them lead back to the
        > same form with the same form variables and some lead to other forms,
        > also with the form variables.
        >
        > How to make this in SFI ASP.NET?
        >
        > I m thinking of another solution, but then my question is:
        >
        > How can I upon receipt of a pressed button event change the whole
        > "current page/webform context" to another webform and paste my current
        > scope of form variables to the other webform, which then runs through
        > its page creation render termination lifecycle? Or because it is already
        > just fine living in memory simply forward the request there?
        >
        >
        > Then when somebody presses a button on the invoice form which requires a
        > redraw of the invoice form it is fine as usual. But when a button is
        > pressed which leads to another webform, then .... what? Redirect the
        > webbrowser to another form with a quazillion bytes long URL? Or can this
        > happen "in memory", on the Server?
        >
        > Regards,
        > Philipp
        >[/color]

        Comment

        • Scott Allen

          #5
          Re: 2 Forms on one page

          You might be able to pull this off with Server.Transfer : this
          technique moves processing to another ASPX page without going back to
          the client. All of the state you need to pass along can go into the
          HttpContext.Ite ms collection.

          A couple more articles to investigate this method:

          The HttpContext Items Collection


          Passing Server Control Values Between Pages


          --s
          [color=blue]
          >
          >Then when somebody presses a button on the invoice form which requires a
          >redraw of the invoice form it is fine as usual. But when a button is
          >pressed which leads to another webform, then .... what? Redirect the
          >webbrowser to another form with a quazillion bytes long URL? Or can this
          >happen "in memory", on the Server?
          >
          >Regards,
          >Philipp[/color]

          --
          Scott

          Comment

          • Philipp Ott

            #6
            Re: 2 Forms on one page

            Hi!


            Scott Allen schrieb:[color=blue]
            > You might be able to pull this off with Server.Transfer : this
            > technique moves processing to another ASPX page without going back to
            > the client. All of the state you need to pass along can go into the
            > HttpContext.Ite ms collection.
            > [...]
            > Passing Server Control Values Between Pages
            > http://msdn.microsoft.com/library/de...tweenpages.asp[/color]

            Thank you for the information. I m reading the infos.

            Is it possible to have two or more references in the second page, so
            that it can be called from two or more pages?

            How can I find out which button was pressed into the first page context?
            Can I ask the Context.Handler what it has in its bag?


            For example:


            <%@ Page Language="C#" Inherits="Secon dPageClass" %>
            <%@ Reference Page="firstpage .aspx" %>
            <%@ Reference Page="otherpage .aspx" %>


            void Page_Load()
            {
            public FirstPageClass fp;
            public OtherPageClass op;

            if (!IsPostBack)
            {
            fp = (FirstPageClass ) Context.Handler ;
            op = (OtherPageClass ) Context.Handler ;
            }
            }



            Thank you,
            regards,
            Philipp

            Comment

            Working...