Try our conversational search powered by Generative AI!

Setting Default Value in an XHTML String



Is it possible to set a significant amount of text as the default value for an XHTML string.

There appears to be quite a short limit on the amount of text that can be entered as the default value, but ideally I would like to put a large amount of HTML in as a default value.

Can this be done?



Dec 01, 2011 17:55


You can set default values in the LoadedDefaultPageData event. In Global.asax or in an IInitializableModule listen to DataFactory.Instance.LoadedDefaultPageData += new PageEventHandler(this.SetValues);

private void SetValues(object sender, PageEventArgs e)
    e.Page["MyProp"] = "Value";

Dec 01, 2011 20:41

Thanks for the reply Johan.

Does this mean the properties are automatically populated on the front end, or will this also apply in the editor environment.

For example, will this show default data in the text editor when the page is first created and in edit mode?


Dec 07, 2011 13:08


This is only for setting default values in edit mode. If you want a default value in a template you have do the logic yourself before rendering it:

<%= CurrentPage["MyString"] as string ?? "Default value" %>


Dec 07, 2011 13:20

Great, it's only in edit mode that I want to do this.

So in the Global.asax would I put the PageEventHandler association in Application_Start?

Thanks again,


Dec 07, 2011 13:38

Exactly. Or using an IInitializableModul, see this blog post.

Dec 07, 2011 13:46

Brilliant, thanks!


Dec 07, 2011 15:00
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.