What is the use of JavaScript in ASP NET

kudvenkat
Youtube
Related Topic
:- Javascript Web Development

1. The use of JavaScript in a web application. 2. Advantages of using JavaScript Run the application. Leave all the fields blank and click the Submit button. The form is posted to the web server, the server validates the form and since all the fields are required fields the user is presented with error messages. In this case the form validation is done on the server. Just to validate the form, there is a round trip between the client browser and the web server. The request has to be sent over the network to the web server for processing. This means if the network is slow or if the server is busy processing other requests, the end user may have to wait a few seconds. Isn't there a way to validate the form on the client side. Yes, we can and that's when we use JavaScript. JavaScript runs on the client broswer. For the Submit button set OnClientClick="return ValidateForm()". This calls the JavaScript ValidateForm() function. The JavaScript code runs on the client browser and validates the form fields. If the fields are left blank the user is presented with an error message right away. This is much faster because there is no round trip between the client and the web server. This also means the load on the server is reduced, and we are using the client machine processing power. If all the form fields are populated the form will be submitted to the server and the server saves the data to the database table. What are the advantages of using JavaScript 1. Form validation can be done on the client side, which reduces the unnecessary round trips between the client and the server. This also means the load on the server is reduced and the application is more responsive. 2. JavaScript uses the client machine processing power. 3. With JavaScript partial page updates are possible i.e only portions of the page can be updated, without reloading the entire web form. This is commonly called as AJAX. 4. JavaScript can also be used to animate elements on a page. For example, show or hide elements and sections of the page.

Comments