Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to close a form after some server side action is finished.

How to close a form after some server side action is finished.

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netsysadminhelptutorial
12 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Dev S

    Hi, I need to close the form in ASP.net C# on clicking the submit button of my form after the records are saved. Help me out plz....... Dev

    C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #3

    If you do, the user will be asked if they want to close the form. Why do you need to do that ?

    Christian Graus Driven to the arms of OSX by Vista.

    D 1 Reply Last reply
    0
    • C Christian Graus

      If you do, the user will be asked if they want to close the form. Why do you need to do that ?

      Christian Graus Driven to the arms of OSX by Vista.

      D Offline
      D Offline
      Dev S
      wrote on last edited by
      #4

      It is required as i m opening this form using window.open alongwith my main form to save partner record and on its close button i hav applied some javascript fucntion so that it could be get on main page. But in case it closed directly from window's close(X) then that function is not executed and some other reasons also forced me to get it close on Submit button's click aftr records are saved. So if you can help me out , i wud b really thankful to you.

      C 1 Reply Last reply
      0
      • K kumar_k508

        Hi, By adding clientscript at the serverside,you can close the page .... ie; by using ClientScript.RegisterClientScriptBlock() you can achieve this...

        D Offline
        D Offline
        Dev S
        wrote on last edited by
        #5

        Thanks kumar but can u give me some more detail of this function.

        C K 2 Replies Last reply
        0
        • D Dev S

          It is required as i m opening this form using window.open alongwith my main form to save partner record and on its close button i hav applied some javascript fucntion so that it could be get on main page. But in case it closed directly from window's close(X) then that function is not executed and some other reasons also forced me to get it close on Submit button's click aftr records are saved. So if you can help me out , i wud b really thankful to you.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #6

          OK, in that case, do what the other guy said. The event that does the save, inserts the script to close the form into the page, so it closes on reload.

          Christian Graus Driven to the arms of OSX by Vista.

          D 1 Reply Last reply
          0
          • D Dev S

            Thanks kumar but can u give me some more detail of this function.

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #7

            How can you be working on a presumably paid project, which has requirements, but not know how to use google, or know about the basics of ASP.NET ?

            Christian Graus Driven to the arms of OSX by Vista.

            1 Reply Last reply
            0
            • D Dev S

              Thanks kumar but can u give me some more detail of this function.

              K Offline
              K Offline
              kumar_k508
              wrote on last edited by
              #8

              hi, The function will work like this: syntax: ClientScript.RegisterClientScriptBlock( Me.GetType(), "Ur ScriptName", "Ur javascript code for closing page ")

              1 Reply Last reply
              0
              • D Dev S

                Hi, I need to close the form in ASP.net C# on clicking the submit button of my form after the records are saved. Help me out plz....... Dev

                K Offline
                K Offline
                kumar_k508
                wrote on last edited by
                #9

                hi, The function will work like this: syntax: ClientScript.RegisterClientScriptBlock( Me.GetType(), "Ur ScriptName", "<script>Ur javascript code for closing page </script>")

                1 Reply Last reply
                0
                • C Christian Graus

                  OK, in that case, do what the other guy said. The event that does the save, inserts the script to close the form into the page, so it closes on reload.

                  Christian Graus Driven to the arms of OSX by Vista.

                  D Offline
                  D Offline
                  Dev S
                  wrote on last edited by
                  #10

                  Can u help me plz that how could i add my javascript function with clientsidde script. Or can u tell me how could i call the close button event after my submit operation completes.

                  1 Reply Last reply
                  0
                  • D Dev S

                    Hi, I need to close the form in ASP.net C# on clicking the submit button of my form after the records are saved. Help me out plz....... Dev

                    S Offline
                    S Offline
                    support synthesys
                    wrote on last edited by
                    #11

                    use javascript on that button click to close that form.

                    S 1 Reply Last reply
                    0
                    • S support synthesys

                      use javascript on that button click to close that form.

                      S Offline
                      S Offline
                      support synthesys
                      wrote on last edited by
                      #12

                      plz refer the foll code of default.aspx page:- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <script language="javascript"> function hi() { window.close(); } </script> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:Button ID="Button1" runat="server" OnClientClick="javascript:hi()" Text="Submit" /></div> </form> </body> </html>

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups