我正在尝试让我的 asp.net 解决方案与 jquery ajax 一起使用。我正在使用这个例子:
http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/
到目前为止我已经有了这个,但是它给了我关于它没有被定义的命名空间错误。 Page
和 WebMethod
未定义...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PDFLibrary.PDFLibrary
{
public partial class SaveStructure : Page
{
[WebMethod]
public static string GetDate()
{
return DateTime.Now.ToString();
}
}
}
有人知道如何解决这个问题吗?
谢谢
最佳答案
Visual Studio 实际上有一种很好的方法来包含缺失的命名空间。右键单击WebMethod
(或任何无法识别的内容),将鼠标悬停在显示Resolve
的子菜单上,然后选择using System.Whatever
,这将是你缺少的命名空间。
这是一个很好的功能,允许您包含命名空间而无需查找它们。
关于c# - 如何在 C# 中使用 jquery ajax?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17332282/