Wednesday, 27 February 2013

ASP.NET: Ajax Call To Server Side Function

kailash chandel
To call the server side function we will use the ajax call. For this we need to call the server side function by a ajax call. To explain this we will have an example.
       Let us have a page named ajaxcall.aspx .  We will take a div with id myDiv and put its text  "Before ajax call when server side function is not called." Now place a button with id Button1 .


ASP.NET: Ajax Call To Server Side Function





There is a method named ServerSideMethod defined on ajaxcall.aspx.cs page.  This method returns the text  "After ajax call when server side function is  called".


ASP.NET: Ajax Call To Server Side Function







Now we want to call the  method ServerSideMethod   on the click of button Button1   and change the text of div myDiv to the message returned by ServerSideMethod. To do this we will make the ajax call to the method by following code:
Firstly add the reference:-
ASP.NET: Ajax Call To Server Side Function
After that write the code:
ASP.NET: Ajax Call To Server Side Function
  

Now when we run the program we have the initial screen:

ASP.NET: Ajax Call To Server Side Function

And after click on the Check button output will be:-

ASP.NET: Ajax Call To Server Side Function


The text of the paragraph has been replaced by the message returned by the method  ServerSideMethod.







Blockchain Technology : Smart Contracts

Origin of Smart Contract Smart contract concept was developed by "Nick Szabo" in 1994 with the goal of bringing practices of...