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. need code for opening new window on button click (without using javascript)

need code for opening new window on button click (without using javascript)

Scheduled Pinned Locked Moved ASP.NET
javascripthtml
12 Posts 7 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.
  • J Jas 007

    i need code for when click on button it opens a new html window and automatically saves that page . :((

    modified on Tuesday, January 20, 2009 5:03

    A Offline
    A Offline
    Abhishek Sur
    wrote on last edited by
    #2

    window.open('url') from javascript.

    Abhishek Sur

    1 Reply Last reply
    0
    • J Jas 007

      i need code for when click on button it opens a new html window and automatically saves that page . :((

      modified on Tuesday, January 20, 2009 5:03

      V Offline
      V Offline
      Vimalsoft Pty Ltd
      wrote on last edited by
      #3

      Use Javascript javascript:var w=window.open('TestPage.aspx','', 'width=625,height=760,scrollbars=yes,resizeable=yes'); Hope it helps

      Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswam@its.co.za

      J 1 Reply Last reply
      0
      • V Vimalsoft Pty Ltd

        Use Javascript javascript:var w=window.open('TestPage.aspx','', 'width=625,height=760,scrollbars=yes,resizeable=yes'); Hope it helps

        Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswam@its.co.za

        J Offline
        J Offline
        Jas 007
        wrote on last edited by
        #4

        hi sir this only creates the page not save the page . can u tell how to write it without javascript.

        J V A 3 Replies Last reply
        0
        • J Jas 007

          hi sir this only creates the page not save the page . can u tell how to write it without javascript.

          J Offline
          J Offline
          J4amieC
          wrote on last edited by
          #5

          Save the page where exactly? You cant force the user to save your page!

          1 Reply Last reply
          0
          • J Jas 007

            hi sir this only creates the page not save the page . can u tell how to write it without javascript.

            V Offline
            V Offline
            Vimalsoft Pty Ltd
            wrote on last edited by
            #6

            When you save a Page i don't understand what you mean , can you please elaborate. Thanks

            Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswam@its.co.za

            1 Reply Last reply
            0
            • J Jas 007

              hi sir this only creates the page not save the page . can u tell how to write it without javascript.

              A Offline
              A Offline
              Abhijit Jana
              wrote on last edited by
              #7

              Jas 007 wrote:

              can u tell how to write it without javascript.

              then use Page.ClientScript.RegisterClientScriptBlock from codebehind

              cheers, Abhijit CodeProject MVP My Recent Article : Exploring Session in ASP.Net

              J G 2 Replies Last reply
              0
              • A Abhijit Jana

                Jas 007 wrote:

                can u tell how to write it without javascript.

                then use Page.ClientScript.RegisterClientScriptBlock from codebehind

                cheers, Abhijit CodeProject MVP My Recent Article : Exploring Session in ASP.Net

                J Offline
                J Offline
                Jas 007
                wrote on last edited by
                #8

                hi abhijit can u clearly explains how to use this

                S 1 Reply Last reply
                0
                • J Jas 007

                  hi abhijit can u clearly explains how to use this

                  S Offline
                  S Offline
                  Sathesh Sakthivel
                  wrote on last edited by
                  #9

                  <%@ Page Language="C#"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> public void Page_Load(Object sender, EventArgs e) { // Define the name and type of the client scripts on the page. String csname1 = "PopupScript"; String csname2 = "ButtonClickScript"; Type cstype = this.GetType(); // Get a ClientScriptManager reference from the Page class. ClientScriptManager cs = Page.ClientScript; // Check to see if the startup script is already registered. if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('Hello World');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } // Check to see if the client script is already registered. if (!cs.IsClientScriptBlockRegistered(cstype, csname2)) { StringBuilder cstext2 = new StringBuilder(); cstext2.Append("<script type=\"text/javascript\"> function DoClick() {"); cstext2.Append("Form1.Message.value='Text from client script.'} </"); cstext2.Append("script>"); cs.RegisterClientScriptBlock(cstype, csname2, cstext2.ToString(), false); } } </script> <html > <head> <title>ClientScriptManager Example</title> </head> <body> <form id="Form1" runat="server"> <input type="text" id="Message" /> <input type="button" value="ClickMe" onclick="DoClick()" /> </form> </body> </html>

                  Sathesh. Blessed is the season which engages the whole world in a conspiracy of love.

                  J 1 Reply Last reply
                  0
                  • J Jas 007

                    i need code for when click on button it opens a new html window and automatically saves that page . :((

                    modified on Tuesday, January 20, 2009 5:03

                    G Offline
                    G Offline
                    Guffa
                    wrote on last edited by
                    #10

                    Jas 007 wrote:

                    i need code for when click on button it opens a new html window

                    That is not possible without Javascript. The only thing that a button can do without Javascript is to post a form to the server. You can use a link with target="_blank" to open it in a new window (or a new tab depending on browser settings).

                    Jas 007 wrote:

                    and automatically saves that page

                    That is not possible, with or without Javascript. You can't do anything at all that involves the file system on the client computer without the interaction of the user.

                    Despite everything, the person most likely to be fooling you next is yourself.

                    1 Reply Last reply
                    0
                    • A Abhijit Jana

                      Jas 007 wrote:

                      can u tell how to write it without javascript.

                      then use Page.ClientScript.RegisterClientScriptBlock from codebehind

                      cheers, Abhijit CodeProject MVP My Recent Article : Exploring Session in ASP.Net

                      G Offline
                      G Offline
                      Guffa
                      wrote on last edited by
                      #11

                      Abhijit Jana wrote:

                      use Page.ClientScript.RegisterClientScriptBlock

                      And what's in the script block that you register? Might it be Javascript? :doh:

                      Despite everything, the person most likely to be fooling you next is yourself.

                      1 Reply Last reply
                      0
                      • S Sathesh Sakthivel

                        <%@ Page Language="C#"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> public void Page_Load(Object sender, EventArgs e) { // Define the name and type of the client scripts on the page. String csname1 = "PopupScript"; String csname2 = "ButtonClickScript"; Type cstype = this.GetType(); // Get a ClientScriptManager reference from the Page class. ClientScriptManager cs = Page.ClientScript; // Check to see if the startup script is already registered. if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('Hello World');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } // Check to see if the client script is already registered. if (!cs.IsClientScriptBlockRegistered(cstype, csname2)) { StringBuilder cstext2 = new StringBuilder(); cstext2.Append("<script type=\"text/javascript\"> function DoClick() {"); cstext2.Append("Form1.Message.value='Text from client script.'} </"); cstext2.Append("script>"); cs.RegisterClientScriptBlock(cstype, csname2, cstext2.ToString(), false); } } </script> <html > <head> <title>ClientScriptManager Example</title> </head> <body> <form id="Form1" runat="server"> <input type="text" id="Message" /> <input type="button" value="ClickMe" onclick="DoClick()" /> </form> </body> </html>

                        Sathesh. Blessed is the season which engages the whole world in a conspiracy of love.

                        J Offline
                        J Offline
                        Jas 007
                        wrote on last edited by
                        #12

                        hi sir , your code does nt fulfill my requirments.

                        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