向客户端发送函数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)
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
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)
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
message = StringUtil.DeleteUnVisibleChar(message);
string js=@"<Script language='JavaScript'>
alert('"+ message +"');</Script>";
HttpContext.Current.Response.Write(js);
}
public static void Alert(object message)
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
string js=@"<Script language='JavaScript'>
alert('{0}');
</Script>";
HttpContext.Current.Response.Write(string.Format(js,message.ToString()));
}
![None.gif](/Images/OutliningIndicators/None.gif)
public static void RtnRltMsgbox(object message,string strWinCtrl)
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
string js = @"<Script language='JavaScript'>
strWinCtrl = true;
strWinCtrl = if(!confirm('"+ message +"'))return false;</Script>";
HttpContext.Current.Response.Write(string.Format(js,message.ToString()));
}
![None.gif](/Images/OutliningIndicators/None.gif)
回到历史页面
/// <summary>
/// 回到历史页面
/// </summary>
/// <param name="value">-1/1</param>
public static void GoHistory(int value)
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
string js=@"<Script language='JavaScript'>
history.go({0});
</Script>";
HttpContext.Current.Response.Write(string.Format(js,value));
}
关闭当前窗口
//
/ <summary>
//
/ 关闭当前窗口
//
/ </summary>
public static
void
CloseWindow()
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
string js=@"<Script language='JavaScript'>
window.close();
</Script>";
HttpContext.Current.Response.Write(js);
HttpContext.Current.Response.End();
}
刷新父窗口
转载于:https://www.cnblogs.com/huazi4995/archive/2006/11/01/546717.html