0

when i use asp.net to coding for website. Asp.net in server call sql server (ado.net, linq or entities framework) and get back data, send for clientside. i use some control as girdview to show data. actually, i do web optimization ( sql server - store procedure, create index, partition => faster, acceleration for get data. Website: UI simple, do not use too many effects)

but why in client-side, when server return data for client, many people always are going to use script (such as javascript, jquery, node js, angular js, bootstrap, react, google o/i....) to show in webpage.

so, it slower or faster when we use girdview?

And when User (people in clientsite) stop scrip in browser, it's mean, Manufacturers allow user or offer to stop script on browser in clientside., so why do we user them ( *.js), when User can stop script?

Even many people use asp.net (new version - 2013) in server, they also use script in there. so asp.net + script in server is faster or slow when we only use asp.net?

please, help me answer.

(I'm apologize because my English is not good.)

Thank you so much.

  • its all about the user experience my friend. if you have everything written on the server side, the application will be making continuous requests for everything which is not a good experience for the end user. On the other hand using scripts makes your life easier. its like making the web application work fast just like a desktop application plus a lot of other stuffs that would be too tedious to do on the server side. there are many more things to say but I am running out of characters here. I am sure others will have their inputs as well. – Sushil Jun 18 '15 at 20:02
  • Client side scripts are used because often it doesn't make sense to involve the server for something, or the server literally can't do something through sending HTML and CSS alone. As for what client side scripting allows us to do, that's too broad of a question. Some high level things are AJAX, Web sockets, manipulating the DOM, performing calculations etc. – mason Jun 18 '15 at 20:02
  • It sounds like you are wondering why people use client side logic versus server side logic. That is quite a large question and not really for SO. There is some discussion of it [here](http://stackoverflow.com/questions/99056/asp-net-webforms-asp-net-ajax-versus-asp-net-mvc-and-ajax-framework-freedom) – JasonWilczak Jun 18 '15 at 20:03
  • you can avoid postback with javascript which is nicer for the user and usually you still do server side validation in case someone turned off javascript. Not everyone uses asp.net too. – loli Jun 18 '15 at 20:06

3 Answers3

1

In the early years of Web development, Javascript on the client side provided for considerable enhancement of the client's "user experience" that static HTML delivered from the server did not. This includes such things as the enabling or disabling of certain interface features based on user input, the appearance or hiding of certain regions of a display based on user input, or combination of other pieces of data.

As web development evolved, the need for even more robust client-side interaction with back-end web servers became evident, and the "frameworks" you mentioned all work in various ways to improve the design, responsiveness, and behavior of a web-based application in ways beyond just enabling or disabling a button. This amounts to complex data binding, callbacks to web services, reducing server round-trips, and creating rich client interfaces, to name only a few.

They're all tools, each with their own role, each working to make web applications a bit more robust than those of the generation before them.

David W
  • 10,062
  • 34
  • 60
  • Thanks so much. so when we use asp.net + script in server is faster or slow when we only use asp.net? hi. – Jacob JC Truong Jun 18 '15 at 21:09
  • Hi! :) Scripting is an integral part of the client web application experience; there's just no escaping it. Now, "scripting in the server" is unclear because there is certainly a back-end language (like C# or VB.NET) component in *any* server-based technology to talk to external resources, but that's not strictly "scripting." The "original" ASP (pre .NET) used interpreted VBScript on the server. The speed or performance gain is realized when we do on a client something that precludes the need for a round trip back to the web server. Am I at least in the ballpark of your question? :) – David W Jun 18 '15 at 21:43
1

If I understand your question right, the answer comes down to speed and preference.

Firstly, if you disable client-side javascript, your asp.net controls aren't going to really work anyway. You'll find few places that still disable this so it's not really a concern people have anymore.

Secondly, it comes down to where you want to focus development effort and what kind of developers you have. If you have a lot of people used to working backend (C#) and want to stay there, then using asp.net controls and the like make development easier.

If you have javascript developers or people who want to use it, then you have more options that allow you to more decouple your server-side code from your front-end code. This can work out well for maintenance purposes.

The real point is that if you can utilize ajax (http://www.w3schools.com/ajax/default.asp) within your web application, you can make it a lot more responsive. ASP.NET Controls can often cause your page to refresh and cause unnecessary server-side computing to get the data and re-render the entire page (or partial page with asp.net mvc). Using new technologies like angular and others you listed, you can focus data computation and network traffic only on what's important.

For example, if you need a table to change what data is loaded, you can make an ajax request JUST for the data you need to load and then just render that portion on the client.

Soriin
  • 36
  • 1
  • 3
  • Thanks so much. so when we use asp.net + script in server is faster or slow when we only use asp.net? hi. this question in channel9, nobody answer me. hi. – Jacob JC Truong Jun 18 '15 at 21:10
  • @JacobJCTruong using asp.net with javascript to do ajax calls has the potential to be faster, yes. It's not so much that one is ALWAYS better than the other, because people can mess anything up, but you have the ability to do more and be more efficient with "asp.net + script" vs "only asp.net." – Soriin Jun 18 '15 at 21:15
0

First of all, every "script" you mentioned (jQuery, AngularJS, Bootstrap, React) is a library written in JavaScript. Except node, which isn't even front-end. And I'm not sure what did you mean by google o/i... JavaScript is currently the only language which works in all browsers.

Initial purpose of JavaScript was to check form values before sending data to servers. It quickly evolved past that, although the usage was throttled by browser adoption, which is still a problem today.

Nowadays we can use JavaScript to render whole webpages. First when opening the page, it can help with rendering, meaning that server doesn't have to do all the work, but can just send plain data, usually in JSON. It's also used to add content to page later, without reloading the page (AJAX). Most well-known examples are real-time chat systems, like the one on facebook. This greatly improves user experience, I can't imagine how terrible it would be if whole page would reload to display a single new message.

Although user can disable JavaScript in their browsers and this would mean the page probably won't work, except if there is fallback design for such cases, I do not know why would someone disable it. And to be honest, probably most of the regular users don't even know this can be done and where is the setting to disable JavaScript.

Marko Gresak
  • 7,950
  • 5
  • 40
  • 46