I have
<%var test = ViewData["test"];%>
<ul class= "list" id = "<%test;%>">
but having error message:
Only assignment, call, increment, decrement, and new object expressions can be used as a statement
What is wrong?
I have
<%var test = ViewData["test"];%>
<ul class= "list" id = "<%test;%>">
but having error message:
Only assignment, call, increment, decrement, and new object expressions can be used as a statement
What is wrong?
Your output block needs to use <%= %>
or <%: %>
if you want it encoded, like this:
<ul class="list" id="<%=test%>">
Though, unless you need the variable all over the place, just use <%= %>
on the original ViewData["test"]
, it's a bit cleaner, at least to me.
try this...
<ul class= "list" id = "<%=test%>">
...you were missing the '=' symbol before 'test' & added an extra ';' after it.