时间:2021-05-20
复制代码 代码如下:
/// <summary>
/// 注册客户端CSS文件
/// </summary>
/// <param name="page"></param>
/// <param name="relativeURL"></param>
public static void RegisterClientCSSFile(Page page, string relativeURL)
{
relativeURL = page.ResolveUrl(relativeURL);
page.Header.Controls.Add(new LiteralControl("\n<link href=\"" + relativeURL + "\" rel=\"stylesheet\" type=\"text/css\">\n"));
}
/// <summary>
/// 网页延迟退出
/// </summary>
/// <param name="page"></param>
/// <param name="script"></param>
/// <param name="delayTime">以秒为单位?</param>
public static void ClosePage(Page page, string script, int delayTime)
{
string closeScript. = "";
closeScript. += "<script. language=javascript>";
closeScript. += "setTimeout(\"ClosePage()\","+ (delayTime * 1000).ToString()+");";
closeScript. += "function ClosePage(){window.close();"+script+"};";
closeScript. += "</script>";
page.ClientScript.RegisterClientScriptBlock(page.GetType(), "ClosePage",
closeScript);
}
/// <summary>
/// 注册客户端脚本文件
/// Creator: Create Time:2009/7/22 13:47:20
/// </summary>
/// <param name="page"></param>
/// <param name="key"></param>
/// <param name="relativeURL"></param>
public static void RegisterClientScriptFile(Page page, string key, string relativeURL)
{
relativeURL = page.ResolveUrl(relativeURL);
if (!page.ClientScript.IsClientScriptIncludeRegistered(key))
{
page.ClientScript.RegisterClientScriptInclude(key, relativeURL);
}
}
/// <summary>
///
/// </summary>
/// <param name="control"></param>
public static void AutoBreakWord(WebControl control)
{
if (control != null)
{
control.Style.Add("word-break", "break-all");
}
}
/// <summary>
///
/// </summary>
/// <param name="control"></param>
public static void DisablePaste(WebControl control)
{
if (control != null)
{
control.Attributes.Add("onpaste", "event.returnValue=false;");
}
}
/// <summary>
///
/// </summary>
/// <param name="control"></param>
public static void DisableKeyDown(WebControl control)
{
if (control != null)
{
control.Attributes.Add("onkeydown", "event.returnValue=false;");
}
}
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
OnClientClick是客户端脚本,一般使用JavaScript,在客户端,也就是IE中运行,点击后马上执行OnClick是服务器端事件处理函数,使用C#或
本文实例讲述了C#编程获取IP地址的方法。分享给大家供大家参考,具体如下:1、获取客户端IP//////获取客户端Ip//////publicStringGet
使用客户端打开指定的URL使用Process.Start方法可以在浏览器打开指定的URL。代码如下所示。[C#]//使用客户端打开“https://”Syste
从客户端调用后台静态方法1.AjaxLibrary方式C#代码:[WebMethod]publicstaticDateTimeGetCurrentTime(st
1、获得aspx客户端请求地址:复制代码代码如下:地址2、C#调用客户端方法:(top.window.document:表父窗体,如果是MainFrame对象在