C# - Maintaining form fields values

Discussion in 'ASP .Net' started by User, Aug 1, 2004.

  1. User

    User Guest

    Form A (Main)
    Text Box 1
    Text Box 2
    Text Box 3

    Form B (Pop-up)
    Choose a selection for Form A/Text Box 3


    Scenario:
    1. User fills out the first two fields (Text Box 1 and Text Box 2) on
    Form A

    2. User clicks on a link for that spawns a pop-up window to choose a
    selection that will populate Test Box 3 on Form A

    3. After hitting the Submit button the page redirects to Form A
    refreshing the page wiping the values from (Text Box 1 and Text Box
    2).


    Question: What can I do to maintain the values on Form A?




    Thanks in advance...
     
    User, Aug 1, 2004
    #1
    1. Advertising

  2. If all you want from Form B is just to pass a parameter back to Forma A,
    Form B doesn't have to submit to the server. Open Form B from Form A with a
    javascript call to showModalDialog and pass the selected value back with
    returnValue. Since there won't be any refresh to Form A, the values of Text
    Box 1 and 2 will persist.

    Eliyahu

    "User" <> wrote in message
    news:...
    >
    > Form A (Main)
    > Text Box 1
    > Text Box 2
    > Text Box 3
    >
    > Form B (Pop-up)
    > Choose a selection for Form A/Text Box 3
    >
    >
    > Scenario:
    > 1. User fills out the first two fields (Text Box 1 and Text Box 2) on
    > Form A
    >
    > 2. User clicks on a link for that spawns a pop-up window to choose a
    > selection that will populate Test Box 3 on Form A
    >
    > 3. After hitting the Submit button the page redirects to Form A
    > refreshing the page wiping the values from (Text Box 1 and Text Box
    > 2).
    >
    >
    > Question: What can I do to maintain the values on Form A?
    >
    >
    >
    >
    > Thanks in advance...
     
    Eliyahu Goldin, Aug 1, 2004
    #2
    1. Advertising

  3. User

    User Guest

    Re: C# - Maintaining form fields values - Elaborated On

    Eliyahu, thanks for the fast reply.

    My apologizes but I need to elaborate on the process. I will try to
    keep this short before it becomes a rat hole.


    Form A (Main)
    Text Box 1
    Text Box 2
    Text Box 3
    Hidden Field
    link to Form B

    Note: Form A is a aspx page

    Form B (Pop-up)
    Choose a selection for Form A: Text Box 3 (For Displaying purposes
    only) and a Hidden Field


    Note: Form B is a asp page with Radio buttons with values from MS SQL

    Scenario:
    1. User fills out the first two fields (Text Box 1 and Text Box 2) on
    Form A

    2. User clicks on a link for that spawns a pop-up window to choose a
    selection that will populate Test Box 3 and a Hidden Field on Form A
    with a radio button

    3. The Submit button is clicked

    4.
    a. aspx function will read the Request.Querystring
    b. capture the value e.g. (10200~Product Name)
    c. split the values based on the '~'
    d.assigned the values into Text Box 3 (Product Name) and the Hidden
    Field (10200) on Form A.

    5. Form A values Text Box 1 and Text Box 2 are no longer there

    So my new question is, there a better way of doing this or what is
    the solution?

    Once again thanks



    On Sun, 1 Aug 2004 10:40:37 +0200, "Eliyahu Goldin"
    <> wrote:

    >If all you want from Form B is just to pass a parameter back to Forma A,
    >Form B doesn't have to submit to the server. Open Form B from Form A with a
    >javascript call to showModalDialog and pass the selected value back with
    >returnValue. Since there won't be any refresh to Form A, the values of Text
    >Box 1 and 2 will persist.
    >
    >Eliyahu
    >
    >"User" <> wrote in message
    >news:...
    >>
    >> Form A (Main)
    >> Text Box 1
    >> Text Box 2
    >> Text Box 3
    >>
    >> Form B (Pop-up)
    >> Choose a selection for Form A/Text Box 3
    >>
    >>
    >> Scenario:
    >> 1. User fills out the first two fields (Text Box 1 and Text Box 2) on
    >> Form A
    >>
    >> 2. User clicks on a link for that spawns a pop-up window to choose a
    >> selection that will populate Test Box 3 on Form A
    >>
    >> 3. After hitting the Submit button the page redirects to Form A
    >> refreshing the page wiping the values from (Text Box 1 and Text Box
    >> 2).
    >>
    >>
    >> Question: What can I do to maintain the values on Form A?
    >>
    >>
    >>
    >>
    >> Thanks in advance...

    >
     
    User, Aug 1, 2004
    #3
  4. Re: C# - Maintaining form fields values - Elaborated On

    My suggestion is good for your scenario. You are passing the selection from
    form B to form A via round trip to the server in a query string. This is
    unnecessary. In form B, upon clicking Submit button, set window.returnValue
    to whatever you want and call window.close(). If form B was called as a
    modal dialog, form A will get the returnValue as a result value of the
    showModalDialog call(). After this call, return value can be assigned to
    Text Box 3. You can't program in ASP.NET without a bit of understanding
    client-side javascript programming.

    Good luck,

    Eliyahu

    "User" <> wrote in message
    news:...
    > Eliyahu, thanks for the fast reply.
    >
    > My apologizes but I need to elaborate on the process. I will try to
    > keep this short before it becomes a rat hole.
    >
    >
    > Form A (Main)
    > Text Box 1
    > Text Box 2
    > Text Box 3
    > Hidden Field
    > link to Form B
    >
    > Note: Form A is a aspx page
    >
    > Form B (Pop-up)
    > Choose a selection for Form A: Text Box 3 (For Displaying purposes
    > only) and a Hidden Field
    >
    >
    > Note: Form B is a asp page with Radio buttons with values from MS SQL
    >
    > Scenario:
    > 1. User fills out the first two fields (Text Box 1 and Text Box 2) on
    > Form A
    >
    > 2. User clicks on a link for that spawns a pop-up window to choose a
    > selection that will populate Test Box 3 and a Hidden Field on Form A
    > with a radio button
    >
    > 3. The Submit button is clicked
    >
    > 4.
    > a. aspx function will read the Request.Querystring
    > b. capture the value e.g. (10200~Product Name)
    > c. split the values based on the '~'
    > d.assigned the values into Text Box 3 (Product Name) and the Hidden
    > Field (10200) on Form A.
    >
    > 5. Form A values Text Box 1 and Text Box 2 are no longer there
    >
    > So my new question is, there a better way of doing this or what is
    > the solution?
    >
    > Once again thanks
    >
    >
    >
    > On Sun, 1 Aug 2004 10:40:37 +0200, "Eliyahu Goldin"
    > <> wrote:
    >
    > >If all you want from Form B is just to pass a parameter back to Forma A,
    > >Form B doesn't have to submit to the server. Open Form B from Form A with

    a
    > >javascript call to showModalDialog and pass the selected value back with
    > >returnValue. Since there won't be any refresh to Form A, the values of

    Text
    > >Box 1 and 2 will persist.
    > >
    > >Eliyahu
    > >
    > >"User" <> wrote in message
    > >news:...
    > >>
    > >> Form A (Main)
    > >> Text Box 1
    > >> Text Box 2
    > >> Text Box 3
    > >>
    > >> Form B (Pop-up)
    > >> Choose a selection for Form A/Text Box 3
    > >>
    > >>
    > >> Scenario:
    > >> 1. User fills out the first two fields (Text Box 1 and Text Box 2) on
    > >> Form A
    > >>
    > >> 2. User clicks on a link for that spawns a pop-up window to choose a
    > >> selection that will populate Test Box 3 on Form A
    > >>
    > >> 3. After hitting the Submit button the page redirects to Form A
    > >> refreshing the page wiping the values from (Text Box 1 and Text Box
    > >> 2).
    > >>
    > >>
    > >> Question: What can I do to maintain the values on Form A?
    > >>
    > >>
    > >>
    > >>
    > >> Thanks in advance...

    > >

    >
     
    Eliyahu Goldin, Aug 1, 2004
    #4
    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. MattC

    Objects not maintaining values

    MattC, May 6, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    492
    Kevin Spencer
    May 6, 2004
  2. User
    Replies:
    0
    Views:
    371
  3. Nathan Sokalski
    Replies:
    1
    Views:
    344
    Nathan Sokalski
    Sep 10, 2008
  4. Rizyak
    Replies:
    4
    Views:
    175
    Rizyak
    Jun 11, 2004
  5. Replies:
    23
    Views:
    523
    Tim Streater
    Dec 18, 2013
Loading...

Share This Page