c#クライアントイベントの登録例

2906 ワード

 
  
///
 /// CSS
 ///

 ///
 ///
 public static void RegisterClientCSSFile(Page page, string relativeURL)
 {
     relativeURL = page.ResolveUrl(relativeURL);
     page.Header.Controls.Add(new LiteralControl("

"));
 }
 ///
 ///
 ///

 ///
 ///
 /// ?
 public static void ClosePage(Page page, string script, int delayTime)
 {
     string closeScript. = "";
     closeScript. += "";
     closeScript. += "setTimeout(\"ClosePage()\","+ (delayTime * 1000).ToString()+");";
     closeScript. += "function ClosePage(){window.close();"+script+"};";
     closeScript. += "";

     page.ClientScript.RegisterClientScriptBlock(page.GetType(), "ClosePage",
  closeScript);
 }
 ///
 ///
 /// Creator: Create Time:2009/7/22 13:47:20
 ///

 ///
 ///
 ///
 public static void RegisterClientScriptFile(Page page, string key, string relativeURL)
 {
     relativeURL = page.ResolveUrl(relativeURL);
     if (!page.ClientScript.IsClientScriptIncludeRegistered(key))
     {
  page.ClientScript.RegisterClientScriptInclude(key, relativeURL);
     }
 }

 ///
 ///
 ///

 ///
 public static void AutoBreakWord(WebControl control)
 {
     if (control != null)
     {
  control.Style.Add("word-break", "break-all");
     }
 }
 ///
 ///
 ///

 ///
 public static void DisablePaste(WebControl control)
 {
     if (control != null)
     {
  control.Attributes.Add("onpaste", "event.returnValue=false;");
     }
 }
 ///
 ///
 ///

 ///
 public static void DisableKeyDown(WebControl control)
 {
     if (control != null)
     {
  control.Attributes.Add("onkeydown", "event.returnValue=false;");
     }
 }