I have an html element (input) that contains several html attributes (placeholder and two data- attributes to show info if element is empty or that input is not valid). I need to make these attributes editable, but I only found Html.EditAttributes helper, which allows me to edit ONE attribute from the list. Is there a way to make sereval attributes editable simultaneously?
You can do like this
@Html.PropertyFor(x => x.AttributeProperty1)
@Html.PropertyFor(x => x.AttributeProperty2)
@Html.PropertyFor(x => x.AttributeProperty3)
<input type="text" data-attr1="@Model.AttributeProperty1" data-attr1="@Model.AttributeProperty2" data-attr1="@Model.AttributeProperty3" />
It's just a sample code as hint, you can modify as your need. Ultimately the solution is to use the PageEditing.PageIsInEditMode
Great! I didn't think about checking editing mode but this solution does exactly what I had needed. Thanks!