Closed markusgud closed 8 years ago
You can use helper method .HtmlAttributes()
to set any attribute just like in regular MVC TextBox.
f.FormGroup().TextBoxFor(x => x.Value).HtmlAttributes(new { @name = "my-name" })
Thank you. Splendid. It works.
I am using this code in the cshtml file:
@f.FormGroup().TextBoxFor(x => x.Value).Id(Model.DataNode+"_Value").Label().LabelText(Model.Label)
But I can not find a way to set the name property, I would like to see its value set to control.Controls[1].Adddress_Value.
<div class=" form-group"><label class="control-label col-lg-2" for="control_Controls_1__Value">Heimilisfang<span class="required">*</span> </label><div class="col-lg-10"><input class="form-control" id="Address_Value" name="control.Controls[1].Value" type="text" value="" /><span class="field-validation-valid" data-valmsg-for="control.Controls[1].Value" data-valmsg-replace="true"></span></div></div>
How can this be accomplished?
Markús