In the following HtmlHelper:
@Html.TextBoxFor(model=>model.Username, new { id = "username", @class = "textbox"})
Some attributes like class have an @ before it while others don't. what does at sign mean there?
In the following HtmlHelper:
@Html.TextBoxFor(model=>model.Username, new { id = "username", @class = "textbox"})
Some attributes like class have an @ before it while others don't. what does at sign mean there?
Some attributes like class have an @ before it while others don't
that is because the C# language has a keyword class already. Only to negate its meaning you use @ . The same thing goes for the C# keyword type and html input element attribute type
class is a reserved word in c#, so it cannot be used as a variable name, for making it valid variable name we need to add @ sign in start of it, it can be used for making a reserved word a valid variable whenever needed.