Bootstrap 字形未显示在表单中 [英] Bootstrap glyphicon not showing in Form
问题描述
我正在尝试不同的方法来制作带有确认的表单.我有以下形式以及一个超链接.下面的超链接正确显示了字形,但表单内的提交按钮只是在灰色按钮中显示为提交".提交按钮和超链接中的 CSS 是否需要不同?
@using (Html.BeginForm("Delete", "Patrol", new { id = item.MemberId })){@Html.AntiForgeryToken()<input type="submit" class="glyphicon glyphicon-trash" onclick="return confirm('Are you sure you want to remove this record?')"/>}<a href="@Url.Action("Delete", new {id = item.MemberId})" onclick="return confirm('您确定要删除这条记录吗?')"><spanclass="glyphicon glyphicon-trash"></span></a>
使用 Firebug
或其他调试器,找到 glyphicon代码> 已定义.在这个
css
文件中,检查 @font-face
部分的 src
位置.您可能需要根据您的 glyphicons
位置在 src
部分中进行一些更改(即添加或删除../")项目如下图:
src: url('../fonts/glyphicons-halflings-regular.eot');
或
src: url('../../fonts/glyphicons-halflings-regular.eot');
另一方面,如果某些应用程序文件在发布到服务器后没有显示出来,您可能需要对文件路径进行以下更改:
来自
~/../../Content/images/img.png
到
./../../Content/images/img.png
并在相关文件的Properties
窗口下,检查是否为它们设置了如下所示的属性:
构建操作:内容
复制到输出目录:不要复制
希望这有帮助...
I'm trying out different ways to do a form with a confirm. I have the following in form as well as just a hyperlink. The hyperlink below is displaying the glyphicon correctly but the submit button inside the form is just displaying as "submit" in a gray button. Does the CSS need to be different in the submit button vs a hyperlink?
<div class="text-center">
@using (Html.BeginForm("Delete", "Patrol", new { id = item.MemberId }))
{
@Html.AntiForgeryToken()
<input type="submit" class="glyphicon glyphicon-trash" onclick="return confirm('Are you sure you want to remove this record?')" />
}
<a href="@Url.Action("Delete", new {id = item.MemberId})" onclick="return confirm('Are you sure you want to remove this record?')"><span class="glyphicon glyphicon-trash"></span></a>
</div>
Using Firebug
or another debugger, find the css
file in which the glyphicon
is defined. In this css
file check the src
location at @font-face
section. You might need to make some changes (i.e. adding or removing ' ../ ') in the src
section according to your glyphicons
location in your project as shown below:
src: url('../fonts/glyphicons-halflings-regular.eot');
or
src: url('../../fonts/glyphicons-halflings-regular.eot');
On the other hand, if some of the application files are not displayed after publishing it to the server, you might need to apply the following changes regarding to file path:
from
~/../../Content/images/img.png
to
./../../Content/images/img.png
And under Properties
window of the related files, check if the properties set for them as shown below:
Build Action : Content
Copy to Output Directory: Do not copy
Hope this helps...
这篇关于Bootstrap 字形未显示在表单中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!