November Happy Hour will be moved to Thursday December 5th.

Extend page definition in code

Vote:
 
Hi I want to add some extra PageReference properties in the DataFactory SavingPage event (code below). The property appears on the edit page but with no value. Any suggestions why not? Is it not OK to set the value like this; currentPage.Property.Add(FOLDER_REF_PROP_NAME + i.ToString(), new PropertyPageReference(new PageReference(_pageId))); ??? Thomas, Gazette // extend PageType EPiServer.DataAbstraction.PageType _pageType = EPiServer.DataAbstraction.PageType.Load(currentPage.PageTypeID); EPiServer.DataAbstraction.PageDefinition _propDef = new PageDefinition(); _propDef.PageTypeID = currentPage.PageTypeID; _propDef.Name = FOLDER_REF_PROP_NAME + i.ToString(); _propDef.EditCaption = FOLDER_REF_PROP_NAME + i.ToString(); _propDef.HelpText = "some help msg ..."; _propDef.DefaultValueType = EPiServer.DataAbstraction.DefaultValueType.None; _propDef.DefaultValue = ""; _propDef.Type = EPiServer.DataAbstraction.PageDefinitionType.Load(4); // 4 = PageReference _propDef.ID = 0; // 0 to create new _propDef.Searchable = false; _propDef.Tab = EPiServer.DataAbstraction.TabDefinition.Load("my tab caption"); try { _propDef.Save(); _pageType.Definitions.Add(_propDef); _pageType.Save(); EPiServer.DataAbstraction.PageType.ClearCache(); } catch (Exception eExp) { // propably property already exists - OK string message = eExp.Message; } currentPage.Property.Add(FOLDER_REF_PROP_NAME + i.ToString(), new PropertyPageReference(new PageReference(_pageId)));
#12388
Oct 07, 2005 0:00
* 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.