I have an ImageButton in a Repeater, and in the Repeater's
OnItemDataBound event, I'd like to add some code that will let the
ImageButton open a URL in a new window.
This is what I have in my Repeater's OnItemDataBound event:
ImageButton oImageButton =
((ImageButton)e.Item.FindControl("ibtnNewWindow")) ;
string sUrl = "http://www.cnn.com"; // Just as an example
string sWindow = string.Concat(@"javascript:window.open(',", sUrl, "',
'_blank', 'toolbars=no,status=no,menubar=no,location=no')");
oImageButton.Attributes.Add("onclick", sWindow);
The works great, except that the new window doesn't retain focus when
it's opened.
How can I use window.Focus() to ensure that the new window receives
focus?
Thanks 2 5452
Try
var newWindow = window.open(sUrl, , '_blank',
'toolbars=no,status=no,menubar=no,location=no');
newWindow.focus();
HTH
Elton Wang
"GD" wrote: I have an ImageButton in a Repeater, and in the Repeater's OnItemDataBound event, I'd like to add some code that will let the ImageButton open a URL in a new window.
This is what I have in my Repeater's OnItemDataBound event:
ImageButton oImageButton = ((ImageButton)e.Item.FindControl("ibtnNewWindow")) ; string sUrl = "http://www.cnn.com"; // Just as an example string sWindow = string.Concat(@"javascript:window.open(',", sUrl, "', '_blank', 'toolbars=no,status=no,menubar=no,location=no')"); oImageButton.Attributes.Add("onclick", sWindow);
The works great, except that the new window doesn't retain focus when it's opened.
How can I use window.Focus() to ensure that the new window receives focus?
Thanks
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Fred Snider |
last post by:
Help!
Opening a new window using the window.open( ) command works great
for opening new windows and having them on top and having the focus.
The window.focus command brings any existing...
|
by: CES |
last post by:
All,
I'm trying to test if a browser is configured so that I can use popup
windows or if it has a popup blocker installed... the only solution I was
able to think of, was one that would pop up a...
|
by: Wei |
last post by:
I need the current window stay on focus. The user will have to click on exit
button to exit the window. How can I do this in asp.net in C#?
Thank you
|
by: Wei |
last post by:
I need the current window stay on focus. The user will have to click on
exit button to exit the window.
When I use the following code, I got an error: "Not implemented"
Code:
private void...
|
by: Frances |
last post by:
this is for a browser window that contains a chat app that is an
applet... when browser window is not in focus I would like users to
somehow get notified when a message arrives, more or less like...
|
by: Roger |
last post by:
Hi,
I am confused about the differences between this.window.focus(),
window.focus(), and this.focus().
I want to use the calls in a <body onload="..."tag. What are the
differences between...
|
by: Jason |
last post by:
Hi,
Here's the scenario:
I have a web application that has window A and window B.
A user has both window A and B open - window A is in the foreground and
window B is behind it.
If the...
|
by: acehigh1983 |
last post by:
Is it possible to focus a window in firefox and safari??
i have a webpage that opens another window, it then focuses on the original window (the new window that opened now behind it in the...
|
by: Spizzat2 |
last post by:
I'm trying to figure out a workaround to a minor annoyance that I'm
coming up with while coding a site. I've got some keyboard shortcuts
set up for the site via javascript, and when I press escape,...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| | |