Part 6 Calling asp net web service from javascript using ajax04:33

  • 0
Published on June 7, 2017

Link for code samples used in the demo

Link for all dot net and sql server video tutorial playlists

In this video, we will discuss calling asp.net web service method from javascript using asp.net ajax.

This is what we want to achieve. Once we type student ID in the textbox and when we click “Get Student” button we want to
1. Invoke StudentWebService from javascript using asp.net AJAX
2. The student web service should return the specific student data from a database table.
3. The returned data should be displayed in the respective textbox controls on the web form.

Steps to call a web service from JavaScript using ASP.NET AJAX
1. Decorate web service class must with [System.Web.Script.Services.ScriptService]
2. Include ScriptManager control on the WebForm from where you want to call the web service and specify the path of the web service.
3. Implement JavaScript function to call the Web Service.

Could you explain how an object-oriented application such as ASP.NET web application can make use of web services to access a relational database ?
In this video, we discussed exactly the same thing. ASP.NET Web application calls the web service, and the web service has ado.net code to retrieve data from a relational database. Just like an asp.net web application, a web service can work with any type of datastore (Relational databases, xml file, text file, access, excel etc)

Where does ADO.NET and XML webservices come in architecture?
Most of the real time applications have 3 or more layers. The most common layers in many of the applications are as follows
1. User Interface of Presentation Layer – Contains only the UI logic
2. Business Logic Layer – Contains logic to validate business rules
3. Data Access Layer – Performs the database CRUD operations

With respect to the above architecture
Web services belong to Business Logic Layer
ADO.NET belong to Data Access Layer

How to call a webservice from the web form without reloading the entire web page.
OR
How to call a webservice without full page postback
Call the web service using ASP.NET AJAX, which allows partial page postback. With partial page postback, only specific portion of the page is updated without reloading the entire page which is better for performance and avoids screen flickers.

https://cafeadobro.ro/

https://www.stagebox.uk/wp-includes/depo10-bonus10/

https://iavec.com.br/

Enjoyed this video?
"No Thanks. Please Close This Box!"