注册客户端事件

        ///

        /// 注册客户端CSS文件

        ///

        ///

        ///

        public static void RegisterClientCSSFile(Page page, string relativeURL)

        {

            relativeURL = page.ResolveUrl(relativeURL);

            page.Header.Controls.Add(new LiteralControl("\n + relativeURL + "\" rel=\"stylesheet\" type=\"text/css\">\n"));

        }

        ///

        /// 退

        ///

        ///

        ///

        /// 秒为单?

        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;");

            }

        }

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28699126/viewspace-772958/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/28699126/viewspace-772958/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值