向客户端发送函数KendoPostBack(eventTarget, eventArgument)
/// 服务器端可接收__EVENTTARGET,__EVENTARGUMENT的值
/// <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);
}
弹出JavaScript小窗口
/// <summary>
/// 弹出JavaScript小窗口
/// </summary>
/// <param name="js">窗口信息</param>
public static void Alert(string message)
{
message = StringUtil.DeleteUnVisibleChar(message);
string js=@"<Script language='JavaScript'>
alert('"+ message +"');</Script>";
HttpContext.Current.Response.Write(js);
}
public static void Alert(object message)
{
string js=@"<Script language='JavaScript'>
alert('{0}');
</Script>";
HttpContext.Current.Response.Write(string.Format(js,message.ToString()));
}
public static void RtnRltMsgbox(object message,string strWinCtrl)
{
string js = @"<Script language='JavaScript'>
strWinCtrl = true;
strWinCtrl = if(!confirm('"+ message +"'))return false;</Script>";
HttpContext.Current.Response.Write(string.Format(js,message.ToString()));
}
回到历史页面
/// <summary>
/// 回到历史页面
/// </summary>
/// <param name="value">-1/1</param>
public static void GoHistory(int value)
{
string js=@"<Script language='JavaScript'>
history.go({0});
</Script>";
HttpContext.Current.Response.Write(string.Format(js,value));
}
关闭当前窗口
/// <summary>
/// 关闭当前窗口
/// </summary>
public static void CloseWindow()
{
string js=@"<Script language='JavaScript'>
window.close();
</Script>";
HttpContext.Current.Response.Write(js);
HttpContext.Current.Response.End();
}
刷新父窗口
posted on
2006-11-01 14:01
huazi4995
阅读(
241)
评论()
编辑
收藏
举报