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. Button click JScript window has wrong request.QueryString

Button click JScript window has wrong request.QueryString

Scheduled Pinned Locked Moved ASP.NET
question
13 Posts 2 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 bubberz

    I used something very similar to this with a dropdownlist selectedindexchange event, and it worked. I figured I'd try it here with a button click event. Any suggestions on how to get this to work?

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

    What is it that you want to put in the querystring, then? --- b { font-weight: normal; }

    B 1 Reply Last reply
    0
    • G Guffa

      What is it that you want to put in the querystring, then? --- b { font-weight: normal; }

      B Offline
      B Offline
      bubberz
      wrote on last edited by
      #5

      The page that has this button, "Update Budget", has the querystring value already that I want. I put that in a label, lblSAID, when the page loads. If I could put request.QueryString("ScheduleActivityID") in the javacode, that'd be great, but it looks like I have to assign it to a variable first. this.value simply puts the value of the button in the querystring when going to the pop-up window

      B G 2 Replies Last reply
      0
      • B bubberz

        The page that has this button, "Update Budget", has the querystring value already that I want. I put that in a label, lblSAID, when the page loads. If I could put request.QueryString("ScheduleActivityID") in the javacode, that'd be great, but it looks like I have to assign it to a variable first. this.value simply puts the value of the button in the querystring when going to the pop-up window

        B Offline
        B Offline
        bubberz
        wrote on last edited by
        #6

        Hmmm..when I try to do "View Source" notepad just hangs. If I use anything else besides this.value in Page_Load, then the popup window won't show. When I do use this.value, then nothing in the button_click handler works anyway. Any other suggestions? Thanks!

        G 1 Reply Last reply
        0
        • B bubberz

          The page that has this button, "Update Budget", has the querystring value already that I want. I put that in a label, lblSAID, when the page loads. If I could put request.QueryString("ScheduleActivityID") in the javacode, that'd be great, but it looks like I have to assign it to a variable first. this.value simply puts the value of the button in the querystring when going to the pop-up window

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

          It's not Java code, it's Javascript code. You can get the value from querystring in javascript: Javascript: querystring[^] --- b { font-weight: normal; }

          B 1 Reply Last reply
          0
          • B bubberz

            Hmmm..when I try to do "View Source" notepad just hangs. If I use anything else besides this.value in Page_Load, then the popup window won't show. When I do use this.value, then nothing in the button_click handler works anyway. Any other suggestions? Thanks!

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

            Empty the Temporary Internet Files, and lower the maximum size of the Temporary Internet Files folder to a reasonable value, like 10 MB. The default value is a certain percent of the entire hard drive, which comes to a ridiculously large value with the sizes of todays hard drives. If you use anything besides this.value that is correct javascript code, the popup window will show. Like this.tagName, this.id, this.name, window.location.href, 'hello', 'anything'... As I said in my first post, you can't use the onclick property when you have a server event that handles the click, as the server event uses the onclick property. --- b { font-weight: normal; }

            1 Reply Last reply
            0
            • G Guffa

              It's not Java code, it's Javascript code. You can get the value from querystring in javascript: Javascript: querystring[^] --- b { font-weight: normal; }

              B Offline
              B Offline
              bubberz
              wrote on last edited by
              #9

              Guffa, So, if I use only the following in the Page_Load (nothing in the button click handler), the window does pop-up, but nothing in the Request.QueryString(): Dim strSAID As String = Request.QueryString("ScheduleActivityID") btnUpdateBudget.Attributes.Add("onClick", "window.open('UpdateBudgetConfirm.aspx?UBID='+'strSAID.ToString()','','width=500,height=300,left=200,top=200');")

              G 1 Reply Last reply
              0
              • B bubberz

                Guffa, So, if I use only the following in the Page_Load (nothing in the button click handler), the window does pop-up, but nothing in the Request.QueryString(): Dim strSAID As String = Request.QueryString("ScheduleActivityID") btnUpdateBudget.Attributes.Add("onClick", "window.open('UpdateBudgetConfirm.aspx?UBID='+'strSAID.ToString()','','width=500,height=300,left=200,top=200');")

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

                The url of the page you open in the window will look like this: UpdateBudgetConfirm.aspx?UBID=strSAID.ToString() If you want to use the value of the strSAID string, you have to concatenate it with the string containing the javascript. E.g.: ...aspx?UBID=" + strSAID + "',','width... --- b { font-weight: normal; }

                B 1 Reply Last reply
                0
                • G Guffa

                  The url of the page you open in the window will look like this: UpdateBudgetConfirm.aspx?UBID=strSAID.ToString() If you want to use the value of the strSAID string, you have to concatenate it with the string containing the javascript. E.g.: ...aspx?UBID=" + strSAID + "',','width... --- b { font-weight: normal; }

                  B Offline
                  B Offline
                  bubberz
                  wrote on last edited by
                  #11

                  I tried this, but now...no pop-up window: btnUpdateBudget.Attributes.Add("onClick", "window.open('UpdateBudgetConfirm.aspx?UBID='" & Request.QueryString("ScheduleActivityID") & ",'','width=500,height=300,left=200,top=200');")

                  G 1 Reply Last reply
                  0
                  • B bubberz

                    I tried this, but now...no pop-up window: btnUpdateBudget.Attributes.Add("onClick", "window.open('UpdateBudgetConfirm.aspx?UBID='" & Request.QueryString("ScheduleActivityID") & ",'','width=500,height=300,left=200,top=200');")

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

                    That is because you have placed the value from the querystring outside of the javascript string. Your javascript code will look like: window.open('UpdateBudgetConfirm.aspx?UBID='42,'','width=500,height=300,left=200,top=200'); Put the value inside the string, like the code I showed you in my previous post. --- b { font-weight: normal; }

                    B 1 Reply Last reply
                    0
                    • G Guffa

                      That is because you have placed the value from the querystring outside of the javascript string. Your javascript code will look like: window.open('UpdateBudgetConfirm.aspx?UBID='42,'','width=500,height=300,left=200,top=200'); Put the value inside the string, like the code I showed you in my previous post. --- b { font-weight: normal; }

                      B Offline
                      B Offline
                      bubberz
                      wrote on last edited by
                      #13

                      Thanks Guffa! That was the trick. Here's what I used: Dim strSAID As String = Request.QueryString("ScheduleActivityID") btnUpdateBudget.Attributes.Add("onClick", "window.open('UpdateBudgetConfirm.aspx?UBID=" + strSAID + "','','width=500,height=300,left=200,top=200');")

                      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