I am having the following pice of code which is firing error
Error 1 Invalid expression term ‘=’
@{
int Interest;
}
<td>@if (@item.interest.HasValue)
{
@Interest= @item.interest.Value.ToString("F2");
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When declaring a variable, this variable needs to be assigned:
and then:
This being said doing something like this in a view is a very bad design. I mean things like declaring and assigning variables based on some condition is not a logic that should be placed in a view. The view is there to display data. This logic should go to your controller or view model.