在整理一套OA发现的有些东西,我会陆续拿出给大家。希望对大家有用!:)
using System;
using System.Web;
using System.Web.UI.HtmlControls ;
using System.Web.UI;
namespace Web.JScript
{
/// <summary>
/// 提供向页面输出客户端代码实现特殊功能的方法
/// </summary>
/// <remarks>
/// </remarks>
public class JScript
{
public static void AlertAndRedirect(string message,string toURL)
{
string js = "<script language=javascript>alert('{0}');window.location.replace('{1}')</script>";
HttpContext.Current.Response.Write(string.Format(js,message ,toURL));
}
/// <summary>
/// 向客户端发送函数KendoPostBack(eventTarget, eventArgument)
/// 服务器端可接收__EVENTTARGET,__EVENTARGUMENT的值
/// </summary>
/// <param name="page">System.Web.UI.Page 一般为this</param>
public static void JscriptSender(System.Web.UI.Page page)
{
page.RegisterHiddenField("__EVENTTARGET","");
page.RegisterHiddenField("__EVENTARGUMENT","");
string s = @"
<script language=Javascript>
function KendoPostBack(eventTarget, eventArgument)
{
var theform = document.forms[0];
theform.__EVENTTARGET.value = eventTarget;
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
</script>";
page.RegisterStartupScript("sds",s);
}
/// <summary>
/// 弹出JavaScript小窗口
/// </summary>
/// <param name="js">窗口信息</param>
public static void Alert(string message)
{
message = StringUtil.DeleteUnVisibleChar(message);
string