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

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -