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. Visual Basic
  4. Redirect another window

Redirect another window

Scheduled Pinned Locked Moved Visual Basic
csharpquestion
12 Posts 3 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 Offline
    B Offline
    BobsAfro
    wrote on last edited by
    #1

    I have code that creates a new window. From within that window I need to be able to redirect the first window using vb.net code becuase I need to build the string first. Any ideas anyone?

    G C 2 Replies Last reply
    0
    • B BobsAfro

      I have code that creates a new window. From within that window I need to be able to redirect the first window using vb.net code becuase I need to build the string first. Any ideas anyone?

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

      You can not do anything to any other window from the server code. If you need a string from the server code, create Javascript code that recreates the string, so that you can use the string in the Javascript.

      --- It's amazing to see how much work some people will go through just to avoid a little bit of work.

      B 1 Reply Last reply
      0
      • G Guffa

        You can not do anything to any other window from the server code. If you need a string from the server code, create Javascript code that recreates the string, so that you can use the string in the Javascript.

        --- It's amazing to see how much work some people will go through just to avoid a little bit of work.

        B Offline
        B Offline
        BobsAfro
        wrote on last edited by
        #3

        I don't know how to recreate it in javascript. Is there anyway I can pass it from vb to js?

        G 1 Reply Last reply
        0
        • B BobsAfro

          I don't know how to recreate it in javascript. Is there anyway I can pass it from vb to js?

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

          BobsAfro wrote:

          I don't know how to recreate it in javascript.

          Here is an example of how you create a string containing code. It's in C#, though. string code = "var s = '" + theString.Replace("\\", "\\\\").Replace("'", "\\'") + "';";

          BobsAfro wrote:

          Is there anyway I can pass it from vb to js?

          No. You can not pass a variable from the server to the browser, you can only send the value of a variable.

          --- It's amazing to see how much work some people will go through just to avoid a little bit of work.

          B 1 Reply Last reply
          0
          • B BobsAfro

            I have code that creates a new window. From within that window I need to be able to redirect the first window using vb.net code becuase I need to build the string first. Any ideas anyone?

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

            The obvious thing to do is to put a property in your code behind that returns the string you want to redirect to, and then create the link in your aspx as usual, but set the link to be <%= your property name %>. The <% creates a block of code behind, and the = means it just renders the string. Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

            B 1 Reply Last reply
            0
            • G Guffa

              BobsAfro wrote:

              I don't know how to recreate it in javascript.

              Here is an example of how you create a string containing code. It's in C#, though. string code = "var s = '" + theString.Replace("\\", "\\\\").Replace("'", "\\'") + "';";

              BobsAfro wrote:

              Is there anyway I can pass it from vb to js?

              No. You can not pass a variable from the server to the browser, you can only send the value of a variable.

              --- It's amazing to see how much work some people will go through just to avoid a little bit of work.

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

              Forgive me but I do not know how building a string in c# is going to help? Please could you explain?

              G 1 Reply Last reply
              0
              • C Christian Graus

                The obvious thing to do is to put a property in your code behind that returns the string you want to redirect to, and then create the link in your aspx as usual, but set the link to be <%= your property name %>. The <% creates a block of code behind, and the = means it just renders the string. Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                B Offline
                B Offline
                BobsAfro
                wrote on last edited by
                #7

                I don't quite understand. The string has to be built onRowCommand. So I cannot build it in advance. It needs to build the string based upon what has been clicked on in the grid.

                1 Reply Last reply
                0
                • B BobsAfro

                  Forgive me but I do not know how building a string in c# is going to help? Please could you explain?

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

                  BobsAfro wrote:

                  Forgive me but I do not know how building a string in c# is going to help? Please could you explain?

                  Maybe I was unclear. Of course you don't have to build the string using C#, any language that you happen to be using works. The example that I presented was in C#, as that's what I am using.

                  --- It's amazing to see how much work some people will go through just to avoid a little bit of work.

                  B 1 Reply Last reply
                  0
                  • G Guffa

                    BobsAfro wrote:

                    Forgive me but I do not know how building a string in c# is going to help? Please could you explain?

                    Maybe I was unclear. Of course you don't have to build the string using C#, any language that you happen to be using works. The example that I presented was in C#, as that's what I am using.

                    --- It's amazing to see how much work some people will go through just to avoid a little bit of work.

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

                    Forgive my stupidity but I do not understand how this wil help. When a user clicks on the grid vb builds a string depending on what was clicked. this string is then used as the querystring for a redirection. How does building a string of code help?

                    G 1 Reply Last reply
                    0
                    • B BobsAfro

                      Forgive my stupidity but I do not understand how this wil help. When a user clicks on the grid vb builds a string depending on what was clicked. this string is then used as the querystring for a redirection. How does building a string of code help?

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

                      If you want to do anything involving another window, you have to do it in the browser, not in the server code. If you have a string that you need for the redirection, then you have to recreate that string in the Javascript code, so that you can use it there.

                      --- It's amazing to see how much work some people will go through just to avoid a little bit of work.

                      B 1 Reply Last reply
                      0
                      • G Guffa

                        If you want to do anything involving another window, you have to do it in the browser, not in the server code. If you have a string that you need for the redirection, then you have to recreate that string in the Javascript code, so that you can use it there.

                        --- It's amazing to see how much work some people will go through just to avoid a little bit of work.

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

                        Okay. Is it possible to take values from the gridiew to buidl the string in javascript?

                        G 1 Reply Last reply
                        0
                        • B BobsAfro

                          Okay. Is it possible to take values from the gridiew to buidl the string in javascript?

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

                          That depends. You can not access the gridview itself, as that does only exist on the server. You might be able to extract values from the html code that the gridview creates.

                          --- It's amazing to see how much work some people will go through just to avoid a little bit of work.

                          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