c# - MVC 4 - Razor - Pass a variable into a href url -
How can I pass a variable into a URL?
What I try is this, but this is not working. The URL only shows:
like this: Rather than combining markup and code parts, the entire URL is included in the markup. http://myurltest.com and not the full path
@if (check1! = "D" ) {& Lt; Li & gt; & Lt; Div class = "a" & gt; & Lt; / Div & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Div class = "b" & gt; & Lt; / Div & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "http://myurltest.com/" + @ check1 + "/ go / 5 / true" & gt; & Lt; Div square = "c" & gt; & Lt; / Div & gt; & Lt; / A & gt; & Lt; / Li & gt; }
& lt ; A Href = '@ string.format ("http://myurltest.com/{0}/go/5/true", check1)' & gt;
Comments
Post a Comment