Hello,
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";
}
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?
Robert
Hi,
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" %>
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,
Robert
Hi,
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?
Thanks,
Robert