ClientScript.RegisterClientScriptBlock?

后端 未结 3 616
情歌与酒
情歌与酒 2020-12-06 18:30

In my web application when i upload a video and click the save button, if the video is uploaded i write the code to display the message video is uploaded. My code is as foll

3条回答
  •  旧时难觅i
    2020-12-06 19:15

    The method System.Web.UI.Page.RegisterClientScriptBlock has been deprecated for some time (along with the other Page.Register* methods), ever since .NET 2.0 as shown by MSDN.

    Instead use the .NET 2.0 Page.ClientScript.Register* methods. - (The ClientScript property expresses an instance of the ClientScriptManager class )

    Guessing the problem

    If you are saying your JavaScript alert box occurs before the page's content is visibly rendered, and therefore the page remains white (or still unrendered) when the alert box is dismissed by the user, then try using the Page.ClientScript.RegisterStartupScript(..) method instead because it runs the given client-side code when the page finishes loading - and its arguments are similar to what you're using already.

    Also check for general JavaScript errors in the page - this is often seen by an error icon in the browser's status bar. Sometimes a JavaScript error will hold up or disturb unrelated elements on the page.

提交回复
热议问题