Simple Ajax Applications in C# (ASP.Net) #.Net Web Applications

Brought from: http://salearningschool.com/displayArticle.php?table=Articles&articleID=1347&title=Simple%20Ajax%20Applications%20in%20C#%20(ASP.Net)

Simple Ajax Applications in C# (ASP.Net)

Note:asmx web-service might be more appropriate in some/many cases

  • If you are coming from PHP or Java Platform where you use JavaScript or jQuery to provide Ajax functionality, you still can use those strategies in ASP.net to provide Ajax functionality
  • Check our short note on Ajax using JavaScript. In .Net, you just have to call the JavaScript function (that implements Ajax functionality) on the event you want the Ajax functionality. However, you do not use runat="server".
  • Another approach is Using Ajax Server Controls such as ScriptManager, ScriptManagerProxy, UpdatePanel, ContentPanel, UpdateProxy
  • You can find these Ajax controls at the Toolbox under Ajax Extensions
  • You can grab them and place on your form, you can grab and place on the code, or you can write them in your code [whatever you are used to]
  • And yes, you could use JQuery as well. JQuery uses a wrapper on JavaScript functionality and makes the life of the developer way easier
  • In this short note, I will show a simple example of using Ajax Server Controls, also show you the code to invoke Ajax functionality using JavaScript
  • Now take a look at the simple application interface below. The application will calculate sum, difference, and multiplication of two numbers without refreshing the page. We will calculate immediately, also will show the situation when the calculation may take a little more time
  • The idea is simple, you need to add a ScriptManager control. If you use master pages, and the situation becomes that you need to place two ScriptManagers, just place one ScriptManager in the Master and use ScriptManagerProxy in the content page
  • use UpdatePanel around the controls that will be refreshed without the page being refreshed
  • Use UpdateProgress control, when you know that the operation will take some time. Use this control to inform the user that the operation is under progress
  • Now the sample application interface
  • Now the Form code
  • Now the backend code
  • Now an example on how to implement Ajax functionality in C# in ASP.net using JavaScript. It just displays current date time but using Ajax and without refreshing the page. Just go through the code

From: http://sitestree.com/?p=3731
Categories:.Net Web Applications
Tags:
Post Data:2016-07-16 11:28:51

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Leave a Reply