G
GD
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
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