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. Using javascript functions ?

Using javascript functions ?

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-nethelpquestion
9 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.
  • K Offline
    K Offline
    kindman_nb
    wrote on last edited by
    #1

    hi,, on my project asp.net with c# I added a javascript item for eg,, name : JS.js and made the next function : function PopUpQtyWindow(id) { window.open("productqty.aspx?id=" + id, "Cart", "status = 1, height = 150, width = 200, resizable = 0"); } then on any page i tried to call this function as next : int prodID = 1 ; HyperTest.NavigateUrl = "javascript:PopUpQtyWindow(" + prodID + ");"; when running project and press the hyperTest .. status message " Error on page " . thanks for all .

    jooooo

    B C S 3 Replies Last reply
    0
    • K kindman_nb

      hi,, on my project asp.net with c# I added a javascript item for eg,, name : JS.js and made the next function : function PopUpQtyWindow(id) { window.open("productqty.aspx?id=" + id, "Cart", "status = 1, height = 150, width = 200, resizable = 0"); } then on any page i tried to call this function as next : int prodID = 1 ; HyperTest.NavigateUrl = "javascript:PopUpQtyWindow(" + prodID + ");"; when running project and press the hyperTest .. status message " Error on page " . thanks for all .

      jooooo

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      1. What error message you get? 2. Do you have configuration like down below? . . . . . .


      I Love T-SQL

      K 1 Reply Last reply
      0
      • K kindman_nb

        hi,, on my project asp.net with c# I added a javascript item for eg,, name : JS.js and made the next function : function PopUpQtyWindow(id) { window.open("productqty.aspx?id=" + id, "Cart", "status = 1, height = 150, width = 200, resizable = 0"); } then on any page i tried to call this function as next : int prodID = 1 ; HyperTest.NavigateUrl = "javascript:PopUpQtyWindow(" + prodID + ");"; when running project and press the hyperTest .. status message " Error on page " . thanks for all .

        jooooo

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

        You can click on that error message to show you details, so you can see what the error is. Either the function is not present, or it's got an error in it. I would recommend installing firefox and the firebug add on, then you can debug your javascript inside the browser.

        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 )

        K 1 Reply Last reply
        0
        • B Blue_Boy

          1. What error message you get? 2. Do you have configuration like down below? . . . . . .


          I Love T-SQL

          K Offline
          K Offline
          kindman_nb
          wrote on last edited by
          #4

          thanks for your reply my friend the error message is appear on the status bar of the internet explorer : Error on page, that is the error message ,, no debug

          jooooo

          1 Reply Last reply
          0
          • C Christian Graus

            You can click on that error message to show you details, so you can see what the error is. Either the function is not present, or it's got an error in it. I would recommend installing firefox and the firebug add on, then you can debug your javascript inside the browser.

            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 )

            K Offline
            K Offline
            kindman_nb
            wrote on last edited by
            #5

            I will install it and try ,, thanks my friend

            jooooo

            1 Reply Last reply
            0
            • K kindman_nb

              hi,, on my project asp.net with c# I added a javascript item for eg,, name : JS.js and made the next function : function PopUpQtyWindow(id) { window.open("productqty.aspx?id=" + id, "Cart", "status = 1, height = 150, width = 200, resizable = 0"); } then on any page i tried to call this function as next : int prodID = 1 ; HyperTest.NavigateUrl = "javascript:PopUpQtyWindow(" + prodID + ");"; when running project and press the hyperTest .. status message " Error on page " . thanks for all .

              jooooo

              S Offline
              S Offline
              samMaster
              wrote on last edited by
              #6

              Hi, Test this way: protected void HyperTest_OnClick(object sender, EventArgs e) { try { int prodID = 1 ; Page.ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "PopUpQtyWindow(" + prodID + ");", true); } catch (Exception ex) { throw; } }

              K 1 Reply Last reply
              0
              • S samMaster

                Hi, Test this way: protected void HyperTest_OnClick(object sender, EventArgs e) { try { int prodID = 1 ; Page.ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "PopUpQtyWindow(" + prodID + ");", true); } catch (Exception ex) { throw; } }

                K Offline
                K Offline
                kindman_nb
                wrote on last edited by
                #7

                Really thanks for your reply .. on my example the code as next : HyperTest.NavigateUrl= .... when i use the code : HyperTest.NavigateUrl= Page.ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "PopUpQtyWindow(" + prodID + ");", true); then error message: Cannot implicitly convert type 'void' to 'string' thanks for aiding me

                jooooo

                S 1 Reply Last reply
                0
                • K kindman_nb

                  Really thanks for your reply .. on my example the code as next : HyperTest.NavigateUrl= .... when i use the code : HyperTest.NavigateUrl= Page.ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "PopUpQtyWindow(" + prodID + ");", true); then error message: Cannot implicitly convert type 'void' to 'string' thanks for aiding me

                  jooooo

                  S Offline
                  S Offline
                  samMaster
                  wrote on last edited by
                  #8

                  No no, HyperTest.NavigateUrl is wrong. Say, I test your code in this way: function PopUpQtyWindow(prodID) { alert(prodID); } And in behind: protected void testClick(object sender, EventArgs e) { int prodID = 1; Page.ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "PopUpQtyWindow(" + prodID + ");", true); } This code is working on both IE and firefox browsers.

                  K 1 Reply Last reply
                  0
                  • S samMaster

                    No no, HyperTest.NavigateUrl is wrong. Say, I test your code in this way: function PopUpQtyWindow(prodID) { alert(prodID); } And in behind: protected void testClick(object sender, EventArgs e) { int prodID = 1; Page.ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "PopUpQtyWindow(" + prodID + ");", true); } This code is working on both IE and firefox browsers.

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

                    so thanks my friend :rose::rose::rose: now it's ok

                    jooooo

                    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