In various project I used the following code to open a document in a window, from an aspx page :
public void viewDocument(string strLink, System.Web.UI.Control ctrlPanel)
{
string strScript;
strScript = "var w=window.open('" + strLink + "','zz');window.focus();";
ScriptManager.RegisterStartupScript(ctrlPanel, ctrlPanel.GetType(), "ShowInfo", strScript, true);
}
and everything is working fine.
I decided to create a toolbox, i.e. a project that contains only functions that can be usefull in many projects. That toolbox is now a dll referenced by the projects.
My problem : my viewDocument function doesn't work anymore. I do not have any javascript error, nothing. In debug mode, I can see that it runs through the "ScriptManager.RegisterStartupScript" command, but no window is opened.
Can someone explain me what I missed ?
Use this snippet. Then you don't need to send
System.Web.UI.Control
as variable.