c# - Invalid expression term ':' in MVC application -
just got started asp.net mvc. created first controller
public actionresult index() { viewdata["currenttime"] = datetime.now.tostring(); return view(); }
and tried set show currenttime
in view like
<%: viewdata["currenttime"] %>
but giving below error:
compiler error message: cs1525: invalid expression term ':'
update: i'm using framework 3.5
the syntax wrong. try
<%= viewdata["currenttime"] %>
instead of
<%: viewdata["currenttime"] %>
Comments
Post a Comment