Hi,
I have a button on my form, and on its click event, I would like to
open a new window of my browser with a specific link.
I have been searching on the net, but can't find the appropriate code.
I hope someone understands my problem, and helps me out.
Thanks in Advance.in the Page_Load method:
myBtn.Attributes.Add("onclick", "java script:window.open('myPage.aspx')");
Regards,
Kostadin Kostov
"Xarky" wrote:
> Hi,
> I have a button on my form, and on its click event, I would like to
> open a new window of my browser with a specific link.
> I have been searching on the net, but can't find the appropriate code.
> I hope someone understands my problem, and helps me out.
> Thanks in Advance.
>
In your Button's Click event, do something like this:
Page.RegisterStartupScript("redirect", "window.open(...)")
When the page loads, the startup script will run to launch the new window.
I forget the params to window.open to launch a new browser. Here are the
docs for it though:
-Brock
DevelopMentor
http://staff.develop.com/ballen
> Hi,
> I have a button on my form, and on its click event, I would like to
> open a new window of my browser with a specific link.
> I have been searching on the net, but can't find the appropriate code.
> I hope someone understands my problem, and helps me out. Thanks in
> Advance.
>
Misfire there. Here are the docs on window.open:
http://www.mozilla.org/docs/dom/dom...ndow_ref76.html
-Brock
DevelopMentor
http://staff.develop.com/ballen
> In your Button's Click event, do something like this:
> Page.RegisterStartupScript("redirect", "window.open(...)")
> When the page loads, the startup script will run to launch the new
> window. I forget the params to window.open to launch a new browser.
> Here are the docs for it though:
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
Thanks for your help. That solved my problem
*** Sent via Developersdex http://www.examnotes.net ***
Hi,
In the Page_Load method I set the following:
myButton.Attributes.Add("onclick",
"java script:window.open('myPage.aspx', 'My Page', 'resizable=yes,
scrollbars=yes, status=yes')");
On clicking, a new window is being opened. Thats working preety good.
Now I need to pass arguments to this new window. I was thinking of
using:
Session["varName"] = data;
But for me its not correct way to do it, because the user may open two
or more of these windows simultaneously and so the previous data would
be overwritten with the new data. Also, I require the data to be passed
to be available all the time while the window is open.
Can someone give me some help on this problem.
Thanks in Advance
*** Sent via Developersdex http://www.examnotes.net ***
Hello xarky d_best,
First off, because you're using the second parameter to window.open ('My
Page'), you'll be targetting a named window. As such, the user will not have
two windows opened up. The second attempt to open the window will result
in the first popup window being refreshed.
Assuming you resolve that, can you pass it on the querystring? Also, there's
a great article [1] at codeproject.com that talks about ProcessContext. This
may also handle what you need to do.
[1] http://www.codeproject.com/useritems/ProcessContext.asp
Matt Berther
http://www.mattberther.com
> Hi,
> In the Page_Load method I set the following:
> myButton.Attributes.Add("onclick",
> "java script:window.open('myPage.aspx', 'My Page', 'resizable=yes,
> scrollbars=yes, status=yes')");
> On clicking, a new window is being opened. Thats working preety good.
> Now I need to pass arguments to this new window. I was thinking of
> using:
> Session["varName"] = data;
> But for me its not correct way to do it, because the user may open two
> or more of these windows simultaneously and so the previous data would
> be overwritten with the new data. Also, I require the data to be
> passed to be available all the time while the window is open.
> Can someone give me some help on this problem.
> Thanks in Advance
> *** Sent via Developersdex http://www.examnotes.net ***
>
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment