Reputation: 5242
I have a model with an attribute int. This attribute is a value that I need to count a forloop.
//Markup
@{var value = Html.DisplayFor(m => m.periodCounter).ToString();}
@for (var i = 0; i < Convert.ToInt32(value); i++)
{
//code here
}
I get the errormessage "Input string was not in a correct format". Is this possible to solve? All I really need to do is declaring a variable with the value of a textbox (in the same view). Right now I have a TextBoxFor and as you can see I'm trying to get and convert it with DisplayFor
Upvotes: 0
Views: 1413