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. General Programming
  3. C#
  4. HELP!!!!!!! ASP.NET C# code behind pop up.

HELP!!!!!!! ASP.NET C# code behind pop up.

Scheduled Pinned Locked Moved C#
csharpasp-netdebugginghelpquestion
9 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.
  • I Offline
    I Offline
    Ibuprofen
    wrote on last edited by
    #1

    private void EnterTIR( string myMSEL, int myPTNumber, int myEntryOrder, int myPTSUBNr ) { string url = "../TCAIMS/Forms/NewTir.aspx?MSEL='"+ myMSEL.ToString() +"'&PTNumber=" + myPTNumber.ToString()+"&EntryOrder="+ myEntryOrder.ToString()+"&PTSUBNr="+ myPTSUBNr.ToString()+"&UID='"+LoginID.Text+"'"; // string windowName = "NewTir"; string openParams = "width=700,height=800,toolbar=1,resizable=1"; StringBuilder sb = new StringBuilder(); sb.Append("" + Environment.NewLine); sb.Append("window.open('" + url + "', '" + windowName + "','" + openParams + "');"); sb.Append(""); Page.RegisterStartupScript("openWindowScript", sb.ToString()); } It just wont open my window, the debugger steps through it all.

    I G 2 Replies Last reply
    0
    • I Ibuprofen

      private void EnterTIR( string myMSEL, int myPTNumber, int myEntryOrder, int myPTSUBNr ) { string url = "../TCAIMS/Forms/NewTir.aspx?MSEL='"+ myMSEL.ToString() +"'&PTNumber=" + myPTNumber.ToString()+"&EntryOrder="+ myEntryOrder.ToString()+"&PTSUBNr="+ myPTSUBNr.ToString()+"&UID='"+LoginID.Text+"'"; // string windowName = "NewTir"; string openParams = "width=700,height=800,toolbar=1,resizable=1"; StringBuilder sb = new StringBuilder(); sb.Append("" + Environment.NewLine); sb.Append("window.open('" + url + "', '" + windowName + "','" + openParams + "');"); sb.Append(""); Page.RegisterStartupScript("openWindowScript", sb.ToString()); } It just wont open my window, the debugger steps through it all.

      I Offline
      I Offline
      Ibuprofen
      wrote on last edited by
      #2

      Okay, after I removed my varibles at the end of my stringurl, it functioned, am I writing something wrong hterE?

      1 Reply Last reply
      0
      • I Ibuprofen

        private void EnterTIR( string myMSEL, int myPTNumber, int myEntryOrder, int myPTSUBNr ) { string url = "../TCAIMS/Forms/NewTir.aspx?MSEL='"+ myMSEL.ToString() +"'&PTNumber=" + myPTNumber.ToString()+"&EntryOrder="+ myEntryOrder.ToString()+"&PTSUBNr="+ myPTSUBNr.ToString()+"&UID='"+LoginID.Text+"'"; // string windowName = "NewTir"; string openParams = "width=700,height=800,toolbar=1,resizable=1"; StringBuilder sb = new StringBuilder(); sb.Append("" + Environment.NewLine); sb.Append("window.open('" + url + "', '" + windowName + "','" + openParams + "');"); sb.Append(""); Page.RegisterStartupScript("openWindowScript", sb.ToString()); } It just wont open my window, the debugger steps through it all.

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

        Do you really want the apostrophes around the values in the query string? They will end up as part of the value when you read the values from the query string. If any of the values in the query string may contain any characters that has a special mening in an url, they have to be url encoded (using the Server.UrlEncode method). If you really want the apostrophes in the values, you have to encode them as \' when putting the url in the Javascript string, otherwise the first apostrophe in the url will end the string. And on a side note: Why on earth are you using string concatenation when you have a StringBuilder? Use the Append method to add each string to the StringBuilder instead of first concatenating strings and then adding them.

        sb.AppendLine("");
        sb.AppendLine("window.open('").Append(url).Append("','").Append(windowName).Append("','" ).Append(openParams).Append("');");
        sb.Append("");

        --- single minded; short sighted; long gone;

        I 1 Reply Last reply
        0
        • G Guffa

          Do you really want the apostrophes around the values in the query string? They will end up as part of the value when you read the values from the query string. If any of the values in the query string may contain any characters that has a special mening in an url, they have to be url encoded (using the Server.UrlEncode method). If you really want the apostrophes in the values, you have to encode them as \' when putting the url in the Javascript string, otherwise the first apostrophe in the url will end the string. And on a side note: Why on earth are you using string concatenation when you have a StringBuilder? Use the Append method to add each string to the StringBuilder instead of first concatenating strings and then adding them.

          sb.AppendLine("");
          sb.AppendLine("window.open('").Append(url).Append("','").Append(windowName).Append("','" ).Append(openParams).Append("');");
          sb.Append("");

          --- single minded; short sighted; long gone;

          I Offline
          I Offline
          Ibuprofen
          wrote on last edited by
          #4

          I did use string bulider. Do I need to use string bulider to bulid the url string?

          I G 2 Replies Last reply
          0
          • I Ibuprofen

            I did use string bulider. Do I need to use string bulider to bulid the url string?

            I Offline
            I Offline
            Ibuprofen
            wrote on last edited by
            #5

            "String bulider does not contain a defination for appendline."

            G 1 Reply Last reply
            0
            • I Ibuprofen

              "String bulider does not contain a defination for appendline."

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

              Right. That is only available in framework 2.0. Use .Append(...).Append(Environment.NewLine) instead.

              --- single minded; short sighted; long gone;

              1 Reply Last reply
              0
              • I Ibuprofen

                I did use string bulider. Do I need to use string bulider to bulid the url string?

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

                Ibuprofen wrote:

                I did use string bulider.

                Yes, but you used string concatenation to create strings to add to the StringBuilder. There is no reason to create the intermittent strings as you can add each string directly to the StringBuilder.

                Ibuprofen wrote:

                Do I need to use string bulider to bulid the url string?

                You don't have to use a StringBuilder at all if you don't want to.

                --- single minded; short sighted; long gone;

                I 1 Reply Last reply
                0
                • G Guffa

                  Ibuprofen wrote:

                  I did use string bulider.

                  Yes, but you used string concatenation to create strings to add to the StringBuilder. There is no reason to create the intermittent strings as you can add each string directly to the StringBuilder.

                  Ibuprofen wrote:

                  Do I need to use string bulider to bulid the url string?

                  You don't have to use a StringBuilder at all if you don't want to.

                  --- single minded; short sighted; long gone;

                  I Offline
                  I Offline
                  Ibuprofen
                  wrote on last edited by
                  #8

                  Guffa, as I test this, I will let you know if it works. I just wanted to say Thank you, you are the first person to ever give me a decent response on code project.

                  I 1 Reply Last reply
                  0
                  • I Ibuprofen

                    Guffa, as I test this, I will let you know if it works. I just wanted to say Thank you, you are the first person to ever give me a decent response on code project.

                    I Offline
                    I Offline
                    Ibuprofen
                    wrote on last edited by
                    #9

                    I never did get this to work, however, I just used a Session Variable. Thanks for your time Guffa!

                    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