Reputation: 1879
Why do I need script on an aspx page?
Upvotes: 2
Views: 140
Reputation: 700322
I'm not sure if you mean why ASP.NET pages requires Javascript, or if you mean additional scripts on the page.
ASP.NET uses Javascript for several types of postbacks. If you for example have a LinkButton, a script is making a postback instead of the default action of the link.
You can use additional scripts on the page for visual effects and to verify data before doing a postback to prevent unneccessary postbacks. (Of course you should also verify the data on the server side to protect against malicious actions.)
Upvotes: 1
Reputation: 21991
It helps in doing things on the client side, which essentially means you can :
There are a lot more implications/uses of using JavaScript.
For knowing more, remember google is your friend!
Thanks
Upvotes: 1
Reputation: 13420
There are a lot of things the server can't really do that well. For example if you want to manipulate the page. You could post the whole thing back to the server with some sort of action and get the server to give you a new page. Or you could just use javascript to change it for you and avoid the trip to the server. It is faster for the client and takes the load off of your server.
Upvotes: 1
Reputation: 8237
Javascript runs on the client side. So if you want anything to happen or change without refreshing the whole page you use javascript.
Upvotes: 1
Reputation: 2940
For client scripting, i.e. validation. There are many scenarios where you need to execute certain logic on the browser's end.
Upvotes: 1
Reputation: 166396
Javascript will allow you to perfrorm client side coding, so to avoid having to post back to the server.
From Using JavaScript Along with ASP.NET
Working logic and application processes on the client-side allows browser based applications to seem more responsive and to have more "snappiness" to them.
Upvotes: 4