Keeping Focus on the popup doc?

tirnaog

New member
Joined
Dec 18, 2007
Messages
3
Programming Experience
10+
Evening all,
Hope someone can tell me what it is I am doing wrong with the below code.
Its suppose to, on clicking the btn in the grids cell, popup a new browser window and keep it on top of the calling browser.

VB.net codebehind, on a ASP.net page.

VB.NET:
Protected Sub uwGridResults_ClickCellButton(ByVal sender As Object, ByVal e 
   As Infragistics.WebUI.UltraWebGrid.CellEventArgs) Handles  
        uwGridResults.ClickCellButton
   
Try            
    Dim strTheLink As String = ""
    strTheLink = "file:" & e.Cell.Row.Cells.FromKey("LinkToFollow").Text
    strTheLink = strTheLink.Replace("\", "/")

    Dim strLink As String = "<script> var myW = window.open('" & strTheLink 
    & "', 'myW'); myW.focus(); </script> " ' '_self'  parent.resizeTo(480,600);

    ClientScript.RegisterStartupScript(Me.GetType(), "ClientScript", strLink)

    Catch ex As Exception

End Try


End Sub
What it does is call up the document in the new browser and then bring the calling browser to the front, hiding the popup document.

What am I doing wrong?

Thanks
Deasun
 
Last edited by a moderator:
From the code it looks like you are opening a popup window and setting the focus to same popup window which is opened. So you will have to remove the myW.focus(); and replace it with window.focus() so that you set the focus to the current parent window which opened this popup window.
 
Actually thats what is happening. The parrent window keeps focus for some reason. I want the child window to keep focus.

Thanks for the reply.
 
Ok does anyone know how to do this?
This seems like it should be a real simple function to do.
Why does the code seem to ignore the .focus part?

It is driving me nuts.
 
Back
Top