jessica L

jessica L

  • NA
  • 6
  • 7.4k

pop up window from gridview header template

Feb 18 2011 2:20 AM

Hi experts,
i need to create a pop up window from the gridview header template, indicated below with this - (?)
but i can't seem to place the header's ID into the page_load, how should I do to let it pop up from the header's template? 
gridview.jpg
Below is the code in aspx.cs :
protected
void Page_Load(object sender, EventArgs e)
{
OpenPopUp(HelpLink,
"QualityHelpRate.aspx", "Help", 450, 650);
}
public static void OpenPopUp(System.Web.UI.WebControls.WebControl opener, string PagePath)
{
string clientScript;
//***Building the client script- window.open***//
clientScript =
"window.open(\'" + PagePath + "\')";
//***regiter the script to the clientside click event of the 'opener' control**//
opener.Attributes.Add(
"onClick", clientScript);
}
public static void OpenPopUp(System.Web.UI.WebControls.WebControl opener, string PagePath, string windowName, int width, int height)
{
string clientScript;
string windowAttribs;
//Building Client side window attributes with width and height.//
//Also the the window will be positioned to the middle of the screen//
windowAttribs =
"width=" + width + "px," + "height=" + height + "px," + "left=\'+((screen.width -" + width + ") / 2)+\'," + "top=\'+ (screen.height - " + height + ")/ 2+\'";

//***Building the client script- window.open, with additional parameters***///
clientScript =
"window.open(\'" + PagePath + "\',\'" + windowName + "\',\'" + windowAttribs + "\');return false;";
//regiter the script to the clientside click event of the 'opener' control*****///
opener.Attributes.Add(
"onClick", clientScript);
}

Answers (5)