views:

236

answers:

3

Theres a war brewing I can feel it!

Old school coders are used to having every server control create events in the .cs files.. for example.. Getting the Initial load of data, Saving Data, Deleting data... and then binding datasources to the server control..

New school coders want to do it in Jquery + AJAX calls to .svc files... That gives automatic no post backs so that is a advantage... and I think its a different way of thinking.. All of a sudden the UI related events are all being done in Jquery..

What is the most modern and efficient way to go ? How can I convince the old school coders to let us you this new paradigm ? (assuming it is the better way)

+2  A: 

It's not a question about old or new. I was using server calls from the client before AJAX and even XmlHttpRequest existed.

It's a matter of what's better suited to do the task. Sometimes you want a server call without reloading the page, sometimes you want to reload the page.

Guffa
Both can do the job. I think as far as old school guys they are worried it ultimatly will make the jquery code too complex for the other .NET coders. For example, If I have a grid with data that I want to save/delete/add on the page then I think it is easier with code behind and serializing the data to a ViewState and handling it in .net.With Jquery I am concerned maybe that gets more complex to handle.
punkouter
+1  A: 

One of the reasons is better using Jquery+AJAX is that you're sending and receiving just the data you need instead of the full postback data travelling to the server and back.

Another reason is esthetic because there is no refreshing on the page, so you have a better user experience.

In the company I used to work, the did some testings on the efficiency between ASP.NET and MVC .NET (for example). I can't send you the graphs and so, but there was an advantage in the use of bandwidth.

I hope it helps

Sergio
In this case the data load isnt important... So I could just put a Updatepanel around everything..For us its more about what creates cleaner code/less code/more maintainable code..(see above example)I like the idea of doing all the UI in jquery and make .net code for services BLL/DAL.. seems like a clean seperation to me
punkouter
+2  A: 

I would say that ASP.NET MVC and the adoption of jQuery is a response to criticism levelled at the ASP.NET webforms + MSAJAX stack.

Webforms was conceived to try bring drag drop control development to the web in the same way applications were built using Visual Basic, ActiveX and COM. Its created a terribly complex and inefficient way of creating web applications.

Although webforms will be around for a while, MVC + jQuery is the way to go, or even dropping ASP.NET on the server side altogether and just using something like extjs/jqueryUI and WCF web services.

James Westgate
So are you saying the way I am thinking about how to use ajax + jquery is really sort of what MVC is about ? So I should take this apporach and use MVC? and if Im sticking with webforms do the classic way of calling code behind events ?
punkouter
Pretty much. MVC is for people who know and understand how to write HTML, javascript and CSS. If you understand the Model View Controller pattern its a bonus but its not a must have. If you've used jQuery with webforms and been frustrated, you'll love it with MVC. Having said that, if you can do it with webforms, theres nothing wrong with that, as long as you keep your viewstate size under control, and use update panels efficiently.
James Westgate
I think what is happening is I am seeing people do all the UI event handling in jquery and I figure ok.. thats less code behind to deal with.. and then I wonder why have any code behind for aspx files? So it looks like I am getting in the mind set now that will make MVC something to consider... the point of webforms was to take advantage of the events of server controls and if i don't take advanttage of that then no sense using webforms.
punkouter