Search code examples
asp.netajaxasp.net-mvc-3nugetmaskedtextbox

ASP.NET AJAX Controls in MVC3?


How would I use the ASP.NET AJAX Controls in MVC3?

e.g. Masked Edit Box

I've installed AJAX Control via NUGET.

and tried adding Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" to the top of the page. but it is not recognised.

And I wonder if its even possible in MVC3 since Ive Never used the toolbar. It would make life so much easier If I could use these tools.


Solution

  • Any ASP.NET server control is meant to be used in Webforms, not in MVC.

    You'll have to find some other HTML helper method to do that or create one yourself so that you may call it like this in your page:

    @this.Html.MaskedEditorBoxFor(m => m.WhateverProperty)