Redirect another window
-
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.
-
I don't know how to recreate it in javascript. Is there anyway I can pass it from vb to js?
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.
-
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?
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
-
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.
-
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
-
Forgive me but I do not know how building a string in c# is going to help? Please could you explain?
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.
-
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.
-
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?
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.
-
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.
-
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.