ASPX templates
Version 7.x > ASPX templates > Default text in editable region View modes: 
User avatar
Member
Member
webteam-rospa - 1/22/2014 10:23:18 AM
   
Default text in editable region
I have a page with an Editable region.

I'd like default text to populate this region, if none is entered, or be in the field by default when the page is first created and can be overridden.

Is this possible?

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 1/24/2014 3:35:10 PM
   
RE:Default text in editable region
Hello,

Please take an inspiration from the following thread:
How to check if CMSEditableRegion has contents or not?

You can pre-fill the Editable region with text in the following way:

You would need to use following code in OnPreRender method of your aspx template:
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
this.MainContentText.LoadContent("some text");
}

where MainContentText is ID of your editable region control.

Best Regards,
Martin Danko