0
我有一个这样的网格列:没有找到图片在MvcHtmlString.Create()
gridSpecs.Column(header: "", columnName: "",
format: (spec) => MvcHtmlString.Create(string.Format(
"<a href='' onclick='RemoveEquipment({0}); return false;'><img src='~/Images/Delete.png' alt='x' /></a>",
spec.Equipment.EquipmentId))),
它工作正常,除了图像是找不到的。
事实上,铬控制台报告:Failed to load resource: the server responded with a status of 404 (Not Found).
但是,如果我把那个确切的代码在网页中的其他地方,对自己,图像将显示:
<img src='~/Images/Delete.png' alt='x' />
任何想法为什么它不会显示在MvcHtmlString.Create()方法内?
删除'〜/'没有用,但用'../../'做了。谢谢! –
@BobHorn,是的,因为现在图像文件夹是存在于两个级别的目录中。 –