在C中调用Javascript函数#

在C中调用Javascript函数#,javascript,c#,clientscript,Javascript,C#,Clientscript,如何在C#中的Web应用程序上向用户显示警报?我试图通过调用我正在编写的C#中的JS函数来实现这一点,但由于无法识别Page.ClientScript,因此我不确定如何实现这一点。我需要包含不同的名称空间吗 using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Transactions; using Syste

如何在C#中的Web应用程序上向用户显示警报?我试图通过调用我正在编写的C#中的JS函数来实现这一点,但由于无法识别Page.ClientScript,因此我不确定如何实现这一点。我需要包含不同的名称空间吗

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Transactions;
using System.Web.Http;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;

.
.
.

while (physAuthToUpdate.start_date < physAuthToUpdate.end_date)
{
   Page.ClientScript.RegisterStartupScript(this.GetType(), "print", "<script>showAlertWindow('Error: End date cannot come before begin date.');</script>");
}
.
.
.
使用系统;
使用System.Collections.Generic;
使用System.Linq;
Net系统;
使用System.Net.Http;
使用系统事务;
使用System.Web.Http;
使用System.Web;
使用System.Web.UI;
使用System.Web.UI.WebControl;
使用系统诊断;
.
.
.
while(physAuthToUpdate.start\u日期
这是一个很好的例子。

如果您希望以内联方式显示警报,也可以简单使用以下命令:

Response.Write("<script>alert('hello');</script>");
Response.Write(“警报('hello');”);
这是一个很好的例子。

如果您希望以内联方式显示警报,也可以简单使用以下命令:

Response.Write("<script>alert('hello');</script>");
Response.Write(“警报('hello');”);

响应需要什么名称空间?System.Web这里是示例:别忘了向上投票它很有帮助:)响应需要什么名称空间?System.Web这里是示例:别忘了向上投票它很有帮助:)