I could have used
@Html.HiddenFor(x=> ViewData["crn"])
but, I get,
<input id="ViewData_crn_" name="ViewData[crn]" type="hidden" value="500" />
To somehow circumvent that issue(id=ViewData_crn_ and name=ViewData[crn]
), I tried doing the following, but the "value" attribute isn't getting set.
@Html.HiddenFor(x => x.CRN, new { @value="1"})
@Html.HiddenFor(x => x.CRN, new { @Value="1"})
generates
<input id="CRN" name="CRN" type="hidden" value="" />
<input Value="500" id="CRN" name="CRN" type="hidden" value="" />
Am I doing anything wrong??
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…