Mike Kantor
Mike Kantor

Reputation: 1454

Using ASP.NET MVC 3 **WITHOUT** jQuery

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?

Upvotes: 2

Views: 1599

Answers (3)

Mikhail
Mikhail

Reputation: 9300

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?

Upvotes: 4

jrummell
jrummell

Reputation: 43117

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.

Upvotes: 9

RubbleFord
RubbleFord

Reputation: 7646

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.

Upvotes: 0

Related Questions