I am working on a project that declares html attributes as @class = "className" or @id = "ID" however for this form control it does not happen:
@Html.CheckBoxFor(Model => Model.IsEBSCreated, new { disabled = "disabled" })
Questions:
- Why does the HTML attribute
disablednot have an@symbol before it? - Is the
@symbol not always required? - Does the HTML attribute
checkedrequire an@symbol?
Thank you
@is used to escape names that would otherwise be C# language keywords (class,checked,bool,abstractetc).minstead ofModelinside HtmlHelper methods becauseModelis the same name asthis.Modelinside a View - name collisions should be avoided.iddoes not require an@But in the code it always has an@so I assume it doesn't break anything if its not necessary but present