0

我有一个 ASPxPopupControl 并且在回调函数中我想调用一个 javascript 函数

<script type="text/javascript">
    function ShowAlert() {
      alert('Display Message Alert');
    }   
</script>


protected void ASPxPopupControl_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e) {

    I want to Call ShowAlert() javascript function from here
}

I tried this code but it only works on button click event

Page.ClientScript.RegisterStartupScript(GetType(), "MyKey",                 "ShowDetailView();", true);
4

1 回答 1

0

这是一个工作代码,它将从代码隐藏中调用 javascript 函数。

<script type="text/javascript">
    function ShowAlert() {
      alert('Display Message Alert');
 }   
</script>

代码背后

Page.ClientScript.RegisterStartupScript(this.GetType(), "Call my function", "ShowAlert();", true);

额外的情况下,如果你想用 javascript 打开一个窗口而不是弹出窗口,

ScriptManager.RegisterStartupScript(Page, typeof(Page), "Alert", "window.open('description.aspx','Mywindow','scrollbars=Yes,width=800,menubar=yes, resizable=No');", true);
于 2013-02-08T06:24:13.073 回答