I have a page which has optional field called "SubHeader" that does not contain any text. I want to add the value of that field using experience manager. Here is my code
string SubHeader = (Model.Component.Fields.ContainsKey("SubHeader")) ? Model.Component.Fields["SubHeader"].Value : String.Empty;
@if (SubHeader != String.Empty) {
<h3>@Html.SiteEditField(Model.Component,Model.Component.Fields["SubHeader"])@SubHeader</h3>
}
else
{
}
In my scenario the value of the Field is empty. Here 'else' block will be executed. I want to write some code in this block to add the values to SubHeader Field. If anybody can suggest the better way to do this.