是否有使用ASP.NET MVC 5 Html.EditorFor()和Bootstrap 3.0的解决方案? [英] Is there a solution for using ASP.NET MVC 5 Html.EditorFor() and Bootstrap 3.0?

查看:229
本文介绍了是否有使用ASP.NET MVC 5 Html.EditorFor()和Bootstrap 3.0的解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问:

有没有一种方法,使ASP.NET MVC 5 Html.EditorFor()的形式佣工改变自引导3形式语法。*?

Is there a way to make the ASP.NET MVC 5 Html.EditorFor() form helpers work with the changed Bootstrap 3 form syntax.*?

讨论(什么,我都看着的话):

Discussion (of what I have looked into already):

这似乎有关于黑客覆盖内置的MVC佣工多那么问题。在一般情况下,它不会像有一个支持的解决方案来修改辅助的HTML。 (请纠正我,如果我错了)

It appears there are a many SO questions regarding hacks to override the built in MVC helpers. In general, it doesn't look like there is a supported solution to modify the helper HTML. (please correct me if I'm wrong)

因此​​,是否有可能建立一个适应助手的2.3.x版本HTML的引导3形式的CSS的外观垫片CSS文件?看来,MVC 5的其他大多数方面都引导3除了自动表单字段兼容。

Therefore, is it possible to build a shim CSS file that adapts the Helper's 2.3.x HTML to the look of the Bootstrap 3 form CSS? It seems that most other aspects of MVC 5 are Bootstrap 3 compatible except for the auto form fields.

一个CSS垫片的好处,就是当ASP.NET MVC更新为原生支持新的引导语法也可能被删除。

The benefit of a CSS shim, is that it could be removed when ASP.NET MVC is updated to support the newer Bootstrap syntax natively.

*我承认,ASP.NET MVC 5仍处于测试阶段,并已发展为引导2.3.x版本,因为3.0还处于测试阶段的时候。

*I acknowledge that ASP.NET MVC 5 is still in beta and has been developed for Bootstrap 2.3.x since 3.0 was also in beta at the time.

推荐答案

有现在的MVC佣工MS解决方案。

There is now a MS solution for the MVC helpers.

<击>目前它 pre-发布,但MVC5.1有

It's currently Pre-release, but MVC5.1 has

MVC 5.1被释放,并具有

MVC 5.1 is released and has

在视图中的引导支持

我们现在允许在HTML属性传递在EditorFor作为一个匿名对象

We now allow passing in html attributes in EditorFor as an anonymous object

举例code ...

Example code...

@Html.EditorFor(model => model, new { htmlAttributes = new { @class = "form-control" }, })

在此此处了解详情....
<一href=\"http://www.asp.net/visual-studio/overview/2013/aspnet-and-web-tools-20132-$p$pview-for-visual-studio-2013-release-notes#mvcbootstrap\">http://www.asp.net/visual-studio/overview/2013/aspnet-and-web-tools-20132-$p$pview-for-visual-studio-2013-release-notes#mvcbootstrap

More info on this here.... http://www.asp.net/visual-studio/overview/2013/aspnet-and-web-tools-20132-preview-for-visual-studio-2013-release-notes#mvcbootstrap

..这里安装说明...
<一href=\"http://blogs.msdn.com/b/webdev/archive/2013/12/09/asp-net-and-web-tools-2013-2-$p$pview-for-visual-studio-2013.aspx\">http://blogs.msdn.com/b/webdev/archive/2013/12/09/asp-net-and-web-tools-2013-2-$p$pview-for-visual-studio-2013.aspx

.. and install instructions here... http://blogs.msdn.com/b/webdev/archive/2013/12/09/asp-net-and-web-tools-2013-2-preview-for-visual-studio-2013.aspx

这篇关于是否有使用ASP.NET MVC 5 Html.EditorFor()和Bootstrap 3.0的解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆