Open Popup Window from hyperlink column

lorena

Centurion
Joined
Oct 23, 2003
Messages
134
Location
Phoenix, Arizona
I have a form with a datagrid on it that allows users to view details of the transactions listed in the grid. Right now, it hyperlinks to an existing page (I set the target="_blank" so it opens a new window) which shows the desired records.I am wondering if there is a way to make the new window essentially a popup window or in some way control its size?
 
i had some old code that did that.. i don't have all of it but here is a snippet... let me know if it looks like something you could use.. if so, i'll try to dig up the project and see what the full code was

Code:
 sURL = "PartInfoQV.aspx?IsPopup=Y"
            sFeatures += (",height=770")
            sFeatures += (",width=900")
            sFeatures += (",top=75")
            sFeatures += (",left=75")
            sFeatures += (",resizable=yes")
            sFeatures += (",scrollbars=yes")
            sFeatures += (",status=yes")
            sFeatures += (",menubar=yes")
            sDHTML = "<script language=JavaScript> var myWindow; myWindow=window.open("
            sDHTML += ("'" + sURL + "', ")
            sDHTML += "null, "
            sDHTML += ("'" + sFeatures + "'); myWindow.focus();")
            sDHTML += "</script>"
            Page.RegisterStartupScript("Popup", sDHTML)
 
actually, that looks like it may be all of it... i'm not sure if this will work in a hyperlink.. you may need to make that column a link column (not sure if they are the same things) and then add the code to the 'ItemCommand' event.

Also, I'm new to all of this so there may be a better way to do it. Good luck.
 
You could always try using javascript, and configuring the new window so that the all the user see is the text area and the minimise, maximise, and close button.

Try this:
1. Add to the html section.
Code:
function newWindow(){
 var doc = document.forms[0];
 window.open("http://localhost/webAppFTP/WebForm2.aspx", "Welcome", "width=350, height=25, resizeable=0, menubar=no, scrollbars=no, status=yes, left=0 , top=0")
}
WebForm2 is actually the page that displays all the information that the user needs.

2.Create a button, set its visibleity to false. In the page load event add the following
Code:
button.attributes.add("onclick", "return newWindow();")

When you want to display the new window, just call the button's method

Mike55.
 
Back
Top