Search code examples
c#asp.net-mvckeywordhtml.textboxfor

TextBoxFor @Value (uppercase) instead @value


This is just for curiosity

Why does this code work:

Html.TextBoxFor(x => x.Age, new { @Value = "0"})

and this doesn't:

Html.TextBoxFor(x => x.Age, new { @value = "0"})

Note the uppercase 'V' in @Value

I know value is a keyword, but so is readonly and it works. It's not necessary to use @Readonly (with uppercase 'R').

Does anybody have a clue?


Solution

  • I'm not 100% sure but, that could be value is a keyword in properties, readonly isn't. Look at properties from MSDN.

    enter image description here

    enter image description here