/// <summary> /// Opens the specifiled url page in the new pop-up window when user clicks on it. /// To bind this behaviour with the specified control, you must call this from the 'Page_Load' event handler method. /// </summary> /// <param name="wc">The web control for which attributs will be added for OnClick javascript.</param> /// <param name="url"></param> /// Last change: 28-12-2005 public static void AddOpenNewWindow(WebControl wc, Uri urlToOpen) { //refine the url urlToOpen = new Uri("\"" + urlToOpen.OriginalString + "\""); //now add the url appropriately wc.Attributes.Add(OnClick, ClientScriptHelper.GetScriptFullLine("window.open(" + urlToOpen.OriginalString + ")")); }
/// <summary> /// Shows the 'Print Dialogue' when user clicks on it and after then when they select the button, the current page will be printed. /// To bind this behaviour with the specified control, you must call this from the 'Page_Load' event handler method. /// </summary> /// <param name="wc">The web control for which attributs will be added for OnClick javascript.</param> public static void AddPrint(WebControl wc) { wc.Attributes.Add(OnClick, ClientScriptHelper.GetScriptFullLine("window.print()")); }
/// <summary> /// Get forward page regarding the number of bowser forward history when user clicks on it. /// To bind this behaviour with the specified control, you must call this from the 'Page_Load' event handler method. /// </summary> /// <param name="wc">The web control for which attributs will be added for OnClick javascript.</param> /// <param name="noToforward">The number of times to get forward regarding browser forward</param> public static void AddForwardWindow(WebControl wc, int noToForward) { wc.Attributes.Add(OnClick, ClientScriptHelper.GetScriptFullLine("history.forward(" + noToForward + ")")); }