[英]How to attach some Model variable as part of @Url.Content in ASP .NET MVC3
The @photo.Image
has an image name. @photo.Image
具有图像名称。
How to attach some Model variable as part of @Url.Content
path in ASP .NET MVC 3? 如何在ASP .NET MVC 3
@Url.Content
某些Model变量附加为@Url.Content
路径的一部分?
<a href="@Url.Content("~/images/????)"> @photo.Title</a>
Thanks!!! 谢谢!!!
只需简单地将照片连接起来即可。
<a href='@Url.Content("~/images/" + photo.Image)'> @photo.Title</a>
Try replacement: 尝试更换:
function GetTabInfo(controllerAction, clientInfoid, stepId)
{
alert(controllerAction);
var url = '@Url.Content("~/xxx")/?clientInfoid=' + clientInfoid + '&stepId=' + stepId;
url = url.replace("xxx", controllerAction);
alert(url);
$.get(url, null, function (result) {
// alert(result);
$(targetDiv).html(result);
});
}
这样,您可以将Variable与字符串连接起来。
src="@Url.Content( "~/Images/"+Model.Pic)"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.