admin管理员组

文章数量:1315346

I need to write an application in ASP.NET MVC, but for corporate reasons I can't use jQuery. I have heard that you can "turn off" jQuery and that ASP.NET controls like TextBoxFor will fall back to using Microsoft's older JS libraries. But I haven't found any detailed information on how to do this.

Anyone have experience with this approach? Any pointers?

I need to write an application in ASP.NET MVC, but for corporate reasons I can't use jQuery. I have heard that you can "turn off" jQuery and that ASP.NET controls like TextBoxFor will fall back to using Microsoft's older JS libraries. But I haven't found any detailed information on how to do this.

Anyone have experience with this approach? Any pointers?

Share Improve this question asked Feb 17, 2012 at 20:17 Mike KantorMike Kantor 1,4545 gold badges27 silver badges46 bronze badges 2
  • Gotta love corporate environments. – hawkke Commented Feb 17, 2012 at 21:38
  • i can understand (sort of), no javascript. how that then subverts to no jquery reeks of corporate misunderstanding and total ignorance (imho). but hey, there's gold in them there (blighted) hills – jim tollan Commented Feb 17, 2012 at 22:15
Add a ment  | 

3 Answers 3

Reset to default 9

ASP.NET MVC does not require jQuery. The MVC3 project templates include it in _Layout.cshtml because many developers prefer it. You can remove it.

It does use jQuery Validation by default, however, but you can use the Microsoft Ajax MVC2 libraries instead.

If you remove jQuery scripts, you will be unable to use the jQuery/Unobtrusive MVC 3 validation.

Use the MS scripts and corresponding validation functionality instead:

_Layout.cshtml:

"~/Scripts/MicrosoftAjax.js"

"~/Scripts/MicrosoftMvcValidation.js"

That’s all.

By the way, why cannot you use the jQuery in your project?

It's all down to the adapters that you decide to include from the default script folders. If you don't want to use Jquery include the other adapter files.

本文标签: javascriptUsing ASPNET MVC 3 **WITHOUT** jQueryStack Overflow