Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
2.78/5 (3 votes)
See more:
Hi All,

Can I use PageMethods in the simple .cshtml page? My application is not MVC but razor works good but when I tried to use <script> PageMethods.xyz(calls,callf);</script> then an error showing PageMethods is not defined.
Or there is another method for get the data from other web services or webmethod in asp.net page.

Thanks,
Posted
Comments
Kornfeld Eliyahu Peter 3-Feb-14 15:08pm    
You want to call a [WebMethod] decorated method sitting inside an aspx page?
zeeShan anSari 3-Feb-14 15:57pm    
Yes,
My method is working on asp.net/aspx page but I want use this method from razor/cshtml page.

Thanks,
Kornfeld Eliyahu Peter 3-Feb-14 16:02pm    
You may use JavaScript via jQuery?
Try these
http://api.jquery.com/jquery.post/
http://api.jquery.com/jquery.get/

1 solution

Thank you......it's work $.ajax({
 
Share this answer
 
Comments
Kornfeld Eliyahu Peter 3-Feb-14 16:47pm    
You welcome...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900