开发者

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)}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜