且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ClientScript不是类C#正常工作

更新时间:2023-12-05 23:11:58

我有这个功能,它始终工作,试试吧。

I have this function, and it always works, try it

public static void callJavascriptFunction(string strScript)
    {

            if (HttpContext.Current == null && HttpContext.Current.Handler is Page) { return; }

            Page currentPage = (Page)HttpContext.Current.Handler;
            ScriptManager.RegisterStartupScript(currentPage,
                                                currentPage.GetType(),
                                                "Funct",
                                                strScript,
                                                true);
    }