【发布时间】:2016-10-29 04:03:23
【问题描述】:
有没有其他方法可以在 asp.net web 应用程序中显示来自后端的警报消息而不是这个。
ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage","alert('Called from code-behind directly!');", true);
我也包含了 using System.Web.UI 命名空间,但这段代码仍然出现以下 2 个错误:
第一个错误:
最好的重载方法匹配 'System.Web.UI.ScriptManager.RegisterStartupScript(System.Web.UI.Page, System.Type, string, string, bool)' 有一些无效 参数 D:\my_backup\Demos\NewShop\NewShop\API\ProductAPIController.cs 85 17 新店
第二个错误:
参数 1:无法从 'NewShop.API.ProductAPIController' 转换为 'System.Web.UI.Page' D:\my_backup\Demos\NewShop\NewShop\API\ProductAPIController.cs 85 53 新店
【问题讨论】:
-
这有什么问题?
-
这段代码有什么错误?什么没有按预期工作?您收到任何错误消息吗?
-
@up-voter :我认为这个问题不值得 +1
-
Response.Write("<script>alert('another way to display the alert message');</script>");
标签: c# asp.net asp.net-mvc code-behind scriptmanager