Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Asp.net page methods not working properly in VS 2013

$
0
0

Hello,

I've just installed VS 2013 and I have some problems with page methods.

I've created a new "ASP.NET Web Forms Website" and added a new asp page using master page.

In code behind file I have the following web method:

[WebMethod]publicstaticstringMyMethod(string world){return"Hello"+ world;}

In the aspx page I have the following code:

<asp:ContentID="BodyContent"ContentPlaceHolderID="MainContent"Runat="Server"><asp:ButtonID="Button1"runat="server"Text="Button"CssClass="test"/><scripttype="text/javascript">$(".test").click(function(e){CallMyMethod();returnfalse;});functionMyMethod_Result(ResultString){
                alert(ResultString);}functionCallMyMethod(){PageMethods.MyMethod("World",MyMethod_Result);}</script></asp:Content>

And in the master page i've enabled page methods.

<asp:ScriptManager runat="server" EnablePageMethods="true">

The problem is that MyMethod function returns the whole page code; I've searched the entire web, found many sollutions but still I can't make this work, and this is just a simple code in a default website.

I've also do the same thing in VS 2012 and there it works. 

I intend to believe that VS 2013 is an upgraded version of VS 2012, but I've experienced the opposite. 

On some search results I've seen that I must add this to web.config file, but I get the same result.

<httpModules><addname="ScriptModule"type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></httpModules>

 

What I do wrong?


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>