-2

I have a method in a class (C# & ASP.Net) that I defined (MyClass.cs) and call this method by Jquery & Ajax. But it does not work. When i call this method in another page (Default.aspx) it works correctly. Please help me. Thanks. enter image description here

I want to call FetchNews() from this class

pezhman t
  • 9
  • 5

1 Answers1

0

Yes you can call right away from MyClass.cs if MyClass.cs inherit from System.Web.UI.Page and aspx.cs (Default.aspx.cs) class inherit .cs(MyClass.cs)

 [WebMethod] attribute must be specified in MyClass.cs testmethod


public class MyClass: System.Web.UI.Page
 {
    [WebMethod]
    public static void Testmethod()
     {


        return '';
    }
}



 public  partial class Default: MyClass
{
...
}
sri_rcnu
  • 101
  • 6