Close WebForm Form

Discussion in 'ASP .Net' started by Joel Finkel, Sep 8, 2003.

  1. Joel Finkel

    Joel Finkel Guest

    Please excuse what may be a mind-blowingly simple question, but I cannot find the answer anywhere.

    I have a webform that displays a list of data. The user click on a link and is displayed a second webform that shows details and allows her to enter new information, which is stored in the database. She may also press a Cancel button.

    In either case, after the new data are stored or if the Cancel button in pressed, I want this webform to vanish, leaving only the original webform, which then has to rebind its data, so that they are updated.

    QUESTION: How do I close the second webform, where the new informaiton has been entered (or cancelled). so that it vanishes? I know I can set up a Javascript close() command, but I would like to know what the canonical method is using the .NET architecture.

    In addition, how does the first webform know when to rebind the data to obtain the updated values for the row that changed?

    Thanks in advance for all suggestions and pointers into the documentation.

    -Joel Finkel
     
    Joel Finkel, Sep 8, 2003
    #1
    1. Advertising

  2. Joel Finkel

    Mark Kamoski Guest

    Joel--

    Here are some thoughts.

    Regarding the question about closing a form, (which in your example below
    seems to mean "closing a browser window"), it seems that this a distinctly
    client-side thing to do. As far as I can tell, JavaScript must be used in
    this case; if not, then I've been lied to many times. However, if, instead
    of opening a new window, you had a post from one page to the next and then
    back to the first, then that would be easier and DotNet surely could handle
    it. Personally, I am against opening new browser windows (unless absolutely
    necessary) because I like the control DotNet provides on the server and I
    try to avoid JavaScript because it can be turned off manually by the
    enduser. But, of course, there are 2 camps of thoughts here; (I'll leave it
    to the other side to argue their "case" for JavaScript and/or opening
    browser windows.)

    Regarding the question about telling a page to refresh, a message or flag
    of some kind must be used. If you use JavaScript to close the form, then
    you can simple re-navigate to the form. Session, QueryString, and a few
    other mechanisms can capture this flag. However, even for this question, I
    recommend using a wizard-style navigation. Show Page1. Click link and show
    Page2. Enter information and Save/Cancel, redirecting to Page1, and so on.

    That's what I think, FWIW.

    HTH.

    --Mark





    "Joel Finkel" <> wrote in message
    news:...
    Please excuse what may be a mind-blowingly simple question, but I cannot
    find the answer anywhere.

    I have a webform that displays a list of data. The user click on a link
    and is displayed a second webform that shows details and allows her to
    enter new information, which is stored in the database. She may also press
    a Cancel button.

    In either case, after the new data are stored or if the Cancel button in
    pressed, I want this webform to vanish, leaving only the original webform,
    which then has to rebind its data, so that they are updated.

    QUESTION: How do I close the second webform, where the new informaiton has
    been entered (or cancelled). so that it vanishes? I know I can set up a
    Javascript close() command, but I would like to know what the canonical
    method is using the .NET architecture.

    In addition, how does the first webform know when to rebind the data to
    obtain the updated values for the row that changed?

    Thanks in advance for all suggestions and pointers into the documentation.

    -Joel Finkel
     
    Mark Kamoski, Sep 8, 2003
    #2
    1. Advertising

  3. Joel Finkel

    Joel Finkel Guest

    Mark,

    Thank you. Your answer provided exactly the insight I needed. In the web
    environemnt, I cannot use the modal windows paradigm. I have to use a
    single-window wizard paradigm. Once you triggered this insight, I was able
    to easily modify my code. It took me a while to find the two .NET ways of
    going from page to page, however.

    1) Response.Redirect()

    2) Server.Transfer()

    It is interesting that I missed this in the introductory documentation I
    read. Maybe like many, I just plugged everything in and fiddled with the
    knobs before reading every line of the owner's manual. On the other hand,
    "Server.Transfer" is found on only two pages in the .NET Framework
    Developer's Guide and "Response.Redirect" only appears on three pages, all
    of which have to do with user authentication. It seems like this is a
    pretty basic technique that one needs to know about!

    Thanks again.

    /Joel


    "Mark Kamoski" <> wrote in message
    news:...
    >
    >
    > Joel--
    >
    > Here are some thoughts.
    >
    > Regarding the question about closing a form, (which in your example below
    > seems to mean "closing a browser window"), it seems that this a distinctly
    > client-side thing to do. As far as I can tell, JavaScript must be used in
    > this case; if not, then I've been lied to many times. However, if, instead
    > of opening a new window, you had a post from one page to the next and then
    > back to the first, then that would be easier and DotNet surely could

    handle
    > it. Personally, I am against opening new browser windows (unless

    absolutely
    > necessary) because I like the control DotNet provides on the server and I
    > try to avoid JavaScript because it can be turned off manually by the
    > enduser. But, of course, there are 2 camps of thoughts here; (I'll leave

    it
    > to the other side to argue their "case" for JavaScript and/or opening
    > browser windows.)
    >
    > Regarding the question about telling a page to refresh, a message or flag
    > of some kind must be used. If you use JavaScript to close the form, then
    > you can simple re-navigate to the form. Session, QueryString, and a few
    > other mechanisms can capture this flag. However, even for this question, I
    > recommend using a wizard-style navigation. Show Page1. Click link and show
    > Page2. Enter information and Save/Cancel, redirecting to Page1, and so on.
    >
    > That's what I think, FWIW.
    >
    > HTH.
    >
    > --Mark
    >
    >
    >
    >
    >
    > "Joel Finkel" <> wrote in message
    > news:...
    > Please excuse what may be a mind-blowingly simple question, but I cannot
    > find the answer anywhere.
    >
    > I have a webform that displays a list of data. The user click on a link
    > and is displayed a second webform that shows details and allows her to
    > enter new information, which is stored in the database. She may also

    press
    > a Cancel button.
    >
    > In either case, after the new data are stored or if the Cancel button in
    > pressed, I want this webform to vanish, leaving only the original webform,
    > which then has to rebind its data, so that they are updated.
    >
    > QUESTION: How do I close the second webform, where the new informaiton has
    > been entered (or cancelled). so that it vanishes? I know I can set up a
    > Javascript close() command, but I would like to know what the canonical
    > method is using the .NET architecture.
    >
    > In addition, how does the first webform know when to rebind the data to
    > obtain the updated values for the row that changed?
    >
    > Thanks in advance for all suggestions and pointers into the documentation.
    >
    > -Joel Finkel
    >
    >
    >
     
    Joel Finkel, Sep 8, 2003
    #3
    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. titof
    Replies:
    0
    Views:
    546
    titof
    Jul 24, 2003
  2. timmso
    Replies:
    1
    Views:
    542
    Alex Papadimoulis
    Dec 12, 2003
  3. =?Utf-8?B?bXN1aw==?=

    Using one webform to set a value on another webform

    =?Utf-8?B?bXN1aw==?=, Jul 12, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    505
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jul 12, 2006
  4. David Laub

    Close a WebForm? SetFocus in a WebForm?

    David Laub, Feb 18, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    345
    Alvin Bruney [MVP]
    Feb 21, 2004
  5. Iñaki Baz Castillo
    Replies:
    7
    Views:
    921
    Iñaki Baz Castillo
    Jan 12, 2010
Loading...

Share This Page