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

Popular posts from this blog

node.js - StackOverflow API not returning JSON -

python - Subclassed QStyledItemDelegate ignores Stylesheet -

php - Laravel 4.1 to Heroku: SQLSTATE[HY000] [2002] No such file or directory -