Adding toastr javascript asp.net webform
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to display a toastr message (info,error etc) after submitting a form using a button and update a gridview control (which is in a update panel" in asp.net webform. Thanks 回答1: You can do it using Page.ClientScript.RegisterStartupScript method. Example: Page.ClientScript.RegisterStartupScript(this.GetType(), "toastr_message", "toastr.error('There was an error', 'Error')", true); But I would probably create a method or extension method to handle that for me: public static void ShowToastr(this Page page, string message, string title,