I'm not entirely sure this is possible, but what I am trying to do is set an element property within a user control to a value passed in via a ViewModel class.
for example, say I have the following ViewModel class
public class myViewModel
{
[DisplayName("Image URL")]
public string URL { get; set;
}
and then have the following defined on the top of my user control
Inherits="System.Web.Mvc.ViewUserControl<Project.ViewModels.myViewModel>"
why can I not do this to set the src property on an Image tag for example?
<img src="<%Model.URL%>" /开发者_运维知识库>
any help would be great, thanks :)
Did you just miss an = before Model.URL?
e.g. <img src="<%=Model.URL %>" />
精彩评论