ASP.NET MVC 2 project default script files. What do you use?


ASP.NET MVC 2 project default script files. What do you use?



Many js files are included into Scripts folder by default in ASP.NET MVC 2 Projects. I suppose developers use jquery library nearly every time they program a site, but what about other files?

Please, can you tell scenarios and reasons when you:

  • Use Microsoft.Ajax instead of jquery or mix both libraries
  • Use JQuery validation infrastructure instead of asp.net mvc one or combine them both

Thank you in advance!

P.S. there are also diferrent editions of the same file. Do you include different editions depenending on debug/release build?


Proper way to build a data Repository in ASP.NET MVC

1:

Why use TagBuilder instead of StringBuilder?
I would personally never mix two JavaScript libraries (MicrosoftAjax and jQuery) in the same project. Difference between HtmlTable and TagBuilder(“table”)Apart from the added download (your users would have to download twice as many JavaScript files) there is quite a bit of duplication - two ajax implementations, two validation implementations etc. Detect whether or not a specific attribute was valid on the modelAs i all know DRY is a good thing to follow.. How to get parameters out of an ascx back to the main aspx page To me the only advantage of using MicrosoftAjax in an ASP.NET MVC project is this it has built-in server-side support - Ajax.Form, Ajax.ActionLink etc. Display Friendly Date, Numbers [duplicate]Built-in client validation is also using it.. Maintaining the query string in ASP.Net MVC However all those things must be done with jQuery and from my experience I think jquery.validate works quite well with data annotations too. “this” in function parameterI have not found any issues so far..

2:

I cannot find any reason to prefer Microsoft AJAX library instead of jQuery. Same for validation. Also I would recommend you using a CDN network to serve static files such as jquery and jquery.validation. So start by removing everything in the Script folder and add only scripts you write yourself..

3:

I usually delete this folder and make a new one under "Content" with just jquery to start with. I feel more comfortable working with jquery instead of microsoft's ajax implementation so I don't need the script file related to Microsoft.Ajax.. And around validation, I like to use jquery.validate for the client side validation and dataannotations model validation for the server side. In MVC1 you would bridge both using a framejob like xVal, haven't done it in mvc2 yet. .


74 out of 100 based on 49 user ratings 484 reviews

@