Introduction
ASP.NET has very good feature, PageMethod (System.Web.Services.WebMethod). We can call any method which is written in page code behind. We can call it by using jQuery. There are a few constraints while making PageMethod.
You can add static page methods to an ASP.NET page and mark them as Web methods. You can then call these methods from script as if they were part of a Web service, but without creating a separate .asmx file. To create Web methods on a page, import the System.Web.Services namespace and add a WebMethodAttribute attribute to each static method that you want to expose. The methods must be marked public more.
Code
First we have to include the jQuery library.
<script type="text/javascript" src="Scripts/jquery-ui-1.8.11.min.js"></script>
<script type="text/javascript" src="Scripts/jquery-1.6.2.js"></script>
<script type="text/javascript" src="Scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="Scripts/jquery-ui-1.8.11.js"></script>
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.


shreeniwas kushwahPosted Aug 21, 2012, 8:57 AM
better .. thanks salman sir
Amit PatelPosted Jun 14, 2012, 3:17 AM
Thanks Salman..
salman ansariPosted Jun 14, 2012, 3:08 AM
nice sample