Closing Webforms using Javascript

Last post 04-16-2008 9:17 AM by Vasu Voice Of Youth. 4 replies.

Sort Posts:

  • Closing Webforms using Javascript

    04-16-2008, 8:10 AM

    Actually my doubt is i have 10 webforms in my application.based on the need i will call that pages.

    And am calling(open) one form from another form by using javascript(window.open).Now i want to close that opened form from the first one.

    Can anyone suggest me how to solve this one?

  • Re: Closing Webforms using Javascript

    04-16-2008, 8:53 AM
    • All-Star
      22,266 point All-Star
    • vik20000in
    • Member since 12-30-2005, 6:02 AM
    • Kolkata
    • Posts 3,464
    • TrustedFriends-MVPs

    This article explains the same

    http://www.gotfusion.com/tutsTD/javaclose.cfm

     

    Vikram
    www.vikramlakhotia.com


    Please mark the answer if it helped you
  • Re: Closing Webforms using Javascript

    04-16-2008, 8:57 AM
    Answer
    • Participant
      1,196 point Participant
    • d_dalapati
    • Member since 09-21-2006, 9:57 AM
    • Kolkata
    • Posts 196

    Try this sample, in this example Child page will be closed from Parent page. But functionality will not work if parent page got refreshed mean while chield page is open.

    <script type="text/javascript">
    var FirstChild;
    var SecondChild;
    function Open1(){FirstChild = window.open("Default6.aspx","FirstChild");}
    function Open2(){SecondChild = window.open("Default7.aspx","SecondChild");}
    function close1(){if(FirstChild){FirstChild.close();}}
    function close2(){if(SecondChild){SecondChild.close();}}
    </script>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" OnClientClick="Open1() ; return false;" runat="server" Text="Open1" />
        <asp:Button ID="Button3" OnClientClick="close1() ; return false;" runat="server" Text="Close1" />
        <br />
        <asp:Button ID="Button2" OnClientClick="Open2() ; return false;" runat="server" Text="Open2" />
        <asp:Button ID="Button4" OnClientClick="close2() ; return false;" runat="server" Text="Close2" />
    </div>
    </form>

  • Re: Closing Webforms using Javascript

    04-16-2008, 9:15 AM

    Ya this is working fine ....

    Thank u very much 4 ur precious information sir.

  • Re: Closing Webforms using Javascript

    04-16-2008, 9:17 AM

    Really thank u very much for ur information

Page 1 of 1 (5 items)