ScriptManager不调用Javascript函数

时间:2019-04-30 17:56:15

标签: javascript c# scriptmanager

我试图从代码隐藏中调用JavaScript函数,该函数将显示模式。使用ScriptManager时不会调用JavaScript函数。请帮忙。

CodeBehind:

def validate_email(self,field):
    # check is none for that user email!
    if UserRegistration.query.filter_by(email=field.data).first():
        raise ValidationError('Your email has been registered already!')

def validate_username(self,field):
    if UserRegistration.query.filter_by(username=field.data).first():
        raise ValidationError('Your username has been registered already!')

JS:

using System;
using System.Web.UI;

namespace test.web.controls
{
    public partial class request_callback : System.Web.UI.UserControl
    {       
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void open_callback_model()
        {
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), 
             "open_callback_modal", "javascript:open_callback_modal();", true);
        }
    }
}

从其他控件调用<telerik:RadCodeBlock ID="rcb" runat="server"> <script type="text/javascript"> function open_callback_modal() { alert('You clicked the button!') $get("btn_open_callback").click(); } </script> </telerik:RadCodeBlock>

open_callback_model()

0 个答案:

没有答案