ASP.NET AJAX Controls in MVC3?

左心房为你撑大大i 提交于 2019-12-12 20:44:47

问题


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.


回答1:


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)



回答2:


Those controls are designed for the aspx rendering engine. If you are using the Razor engine, you need to look up other alternatives for the masked edit box, like some jQuery plugin.

I found this: http://digitalbush.com/projects/masked-input-plugin/

Haven't used it, so I cannot vouch for it...



来源:https://stackoverflow.com/questions/9127093/asp-net-ajax-controls-in-mvc3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!