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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to close a webform while opening another webform??

How to close a webform while opening another webform??

Scheduled Pinned Locked Moved ASP.NET
questioncsharpjavascriptasp-netvisual-studio
3 Posts 3 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.
  • B Offline
    B Offline
    biswa47
    wrote on last edited by
    #1

    i am devlopping a asp.net application in (VS 2005). wheren in my default.aspx page there is a provision for login and that login control is resides with in "frame". Now when i login sucessfully it redirects to a new default2.aspx page. My problem is that after login 2pages are there in the window . i want to close the "default1.aspx " when default2.aspx is loaded in the window. how can i do in the server side. to open a new defaul2.aspx page in a new window i have written the follwing code. System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script language='javascript'>"); sb.Append("window.open('Boundry/ScrUserHome.aspx', 'PopUp',"); sb.Append("'top=0, left=0, width='+screen.availwidth+', height='+screen.availheight+', menubar=no,scrollbar=yes,toolbar=no,resizable=yes,addressbar=no');<"); sb.Append("/script>"); Type t = this.GetType(); if (!ClientScript.IsClientScriptBlockRegistered(t, "PopupScript")) ClientScript.RegisterClientScriptBlock(t, "PopupScript", sb.ToString()); now how to close default1.aspx page in the server side????

    C A 2 Replies Last reply
    0
    • B biswa47

      i am devlopping a asp.net application in (VS 2005). wheren in my default.aspx page there is a provision for login and that login control is resides with in "frame". Now when i login sucessfully it redirects to a new default2.aspx page. My problem is that after login 2pages are there in the window . i want to close the "default1.aspx " when default2.aspx is loaded in the window. how can i do in the server side. to open a new defaul2.aspx page in a new window i have written the follwing code. System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script language='javascript'>"); sb.Append("window.open('Boundry/ScrUserHome.aspx', 'PopUp',"); sb.Append("'top=0, left=0, width='+screen.availwidth+', height='+screen.availheight+', menubar=no,scrollbar=yes,toolbar=no,resizable=yes,addressbar=no');<"); sb.Append("/script>"); Type t = this.GetType(); if (!ClientScript.IsClientScriptBlockRegistered(t, "PopupScript")) ClientScript.RegisterClientScriptBlock(t, "PopupScript", sb.ToString()); now how to close default1.aspx page in the server side????

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

      You'd do better to stick to the one page, but you can use window.close() to close the current window. The user will be asked if they want to close it.

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      1 Reply Last reply
      0
      • B biswa47

        i am devlopping a asp.net application in (VS 2005). wheren in my default.aspx page there is a provision for login and that login control is resides with in "frame". Now when i login sucessfully it redirects to a new default2.aspx page. My problem is that after login 2pages are there in the window . i want to close the "default1.aspx " when default2.aspx is loaded in the window. how can i do in the server side. to open a new defaul2.aspx page in a new window i have written the follwing code. System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script language='javascript'>"); sb.Append("window.open('Boundry/ScrUserHome.aspx', 'PopUp',"); sb.Append("'top=0, left=0, width='+screen.availwidth+', height='+screen.availheight+', menubar=no,scrollbar=yes,toolbar=no,resizable=yes,addressbar=no');<"); sb.Append("/script>"); Type t = this.GetType(); if (!ClientScript.IsClientScriptBlockRegistered(t, "PopupScript")) ClientScript.RegisterClientScriptBlock(t, "PopupScript", sb.ToString()); now how to close default1.aspx page in the server side????

        A Offline
        A Offline
        Ashish Sehajpal
        wrote on last edited by
        #3

        there is no point of opening a newer window if you need to close existing one ? atleast the web architecture doesn't allow such flows. try to change the current page with the newer page in same browser window...

        Ashish Sehajpal

        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