Dean_Hastings
asked on
Popup Window doesn't work with smartNavigation enabled?
I am using the following Sub to open a popup browser window when btnOpen is clicked.
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
Response.Write("<script>wi ndow.open( 'ClientSid ePopupChil d.aspx',nu ll,'width= 400,height =300');</s cript>")
End Sub
This works fine when smartNavigation for the page is disabled. Once smartNavigation is enabled a client side error "invalid pointer" is produced.
Does anyone now what I am doing wrong? Any help is appreciated.
Dean
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
Response.Write("<script>wi
End Sub
This works fine when smartNavigation for the page is disabled. Once smartNavigation is enabled a client side error "invalid pointer" is produced.
Does anyone now what I am doing wrong? Any help is appreciated.
Dean
ASKER
This works (with Response.write line removed) except that the popup window is tucked behind the parent window. The focus needs to be on the popup window?
Dean.
Dean.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Tried your suggestion. Focus is still falling on the parent window?
i've tried this on my computer and it works fine!
ASKER
Was smartNavigation enabled on your PC?
On my PC, with smartNavigation disabled the focus is on the child page. With smartNavigation enabled the focus is on the parent.
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
Dim scriptString As String = "<script language=JavaScript>"
scriptString += "var w = window.open('ClientSidePop upChild.as px',null,' width=400, height=300 ');w.focus ();</scrip t>"
If (Not IsClientScriptBlockRegiste red("clien tScript")) Then
RegisterClientScriptBlock( "clientScr ipt", scriptString)
End If
End Sub
By the way, thanks for your help on this!!
On my PC, with smartNavigation disabled the focus is on the child page. With smartNavigation enabled the focus is on the parent.
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
Dim scriptString As String = "<script language=JavaScript>"
scriptString += "var w = window.open('ClientSidePop
If (Not IsClientScriptBlockRegiste
RegisterClientScriptBlock(
End If
End Sub
By the way, thanks for your help on this!!
no, i don't use smartNavigation!
B..M
B..M
ASKER
This is the problem I have, as I am using smartNavigation.
try this
in page_load
btnOpen.Attributes.Add("on click", "<scrip language=javascript>var w = window.open('ClientSidePop upChild.as px',null,' width=400, height=300 ');w.focus ();</scrip t>")
and remove the client script from the onclick server event
By the way, please excuse me that i've not read your question carefully
B..M
in page_load
btnOpen.Attributes.Add("on
and remove the client script from the onclick server event
By the way, please excuse me that i've not read your question carefully
B..M
ASKER
Got a syntax error when including the <script> tag.
Using the following provided a popup window but the focus was still on the parent.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
btnOpen.Attributes.Add("on click", "var w = window.open('ClientSidePop upChild.as px',null,' width=400, height=300 ');w.focus ();")
End Sub
Maybe smartNavigation gives more pain than gain??
Using the following provided a popup window but the focus was still on the parent.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
btnOpen.Attributes.Add("on
End Sub
Maybe smartNavigation gives more pain than gain??
try to wrte a client script in your aspx page
<script language="javascript">
function showMe()
{
var w = window.open('ClientSidePop upChild.as px',null,' width=400, height=300 ');
w.focus();
}
</script>
and modify this
btnOpen.Attributes.Add("on click", "var w = window.open('ClientSidePop upChild.as px',null,' width=400, height=300 ');w.focus ();")
to
btnOpen.Attributes.Add("on click", "showMe()")
HTH
B..M
<script language="javascript">
function showMe()
{
var w = window.open('ClientSidePop
w.focus();
}
</script>
and modify this
btnOpen.Attributes.Add("on
to
btnOpen.Attributes.Add("on
HTH
B..M
ASKER
Focus still on Parent window after moving client script into aspx page!
sorry Dean, i'm out of ideas :(
B..M
B..M
SmartNavigation doesn't interfere with the focus if you use an html control instead of a server control to open a popup window:
<script>
function OpenWindow()
{
window.open('ClientSidePop upChild.as px',null,' width=400, height=300 ');
}
</script>
<a href="javascript:OpenWindo w">Click here to open window</a>
<script>
function OpenWindow()
{
window.open('ClientSidePop
}
</script>
<a href="javascript:OpenWindo
Here is a solution for returning the focus to the child even with SmartNavigation enabled.
https://www.experts-exchange.com/questions/20988044/bring-a-window-to-the-front.html
John
https://www.experts-exchange.com/questions/20988044/bring-a-window-to-the-front.html
John
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
Response.Write("<script>wi
Dim scriptString as String = "<script language=JavaScript>"
scriptString += "window.open('ClientSidePo
If(Not IsClientScriptBlockRegiste
RegisterClientScriptBlock(
End If
End Sub
B..M