How do I use a spark variable in an html helper?
Can I use a spark variable inside an html helper?
Say we have
<var url="Url.Action(“get”)" />
!{Html.Image("~/Content/up.png")}
Now if I need to use the url
inside Html.Image
as an attribute(part of th开发者_JAVA百科e 2nd param) to get
<img src="~/Content/up.png" type="~/engine/get" />
how do I go about doing it?
<var url='Url.Action("get")' />
is converted to
var url = Url.Action("get");
when interpreting view code, so you can use url
as C# variable later:
!{Html.Image("~/Content/up.png",url)}
精彩评论