Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
You can do like this
@if (PageEditing.PageIsInEditMode)
{
@Html.PropertyFor(x => x.AttributeProperty1)
@Html.PropertyFor(x => x.AttributeProperty2)
@Html.PropertyFor(x => x.AttributeProperty3)
}
else
{
<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!
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?