Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
I'm not completely sure that this is the problem, but in CMS5 PageData object properties are read-only, so that might be what is stopping you. You should try doing this:
PageData writablePage = e.Page.CreateWritableClone();
writablePage.Property["PageName"].DisplayEditUI = false;
I also can't see you saving the changes anywhere.
DataFactory.Instance.Save(writablePage, EPiServer.DataAccess.SaveAction.Publish);
I hope that helps!
I set the value with
static void Instance_CreatingPage(object sender, EPiServer.PageEventArgs e)
{
e.Page.PageName ="xxx"
}
and it works fine.
But i need to hide the property "page name" when the user edit the page.
Hi Ivan,
I think you could use Fredrik Haglunds code in this blog post: http://blog.fredrikhaglund.se/blog/2009/06/08/move-built-in-property-to-another-tab-when-editing/ , but instead set OwnerTab to "-1". I think that should work.
Another way is to subclass PropertyStringControl and use EPiServer.Core.PropertyControlClassFactory.Instance.RegisterClass from your global.asax Application_Start event handler to inject your subclass. In that class you can, for example, render the editcontrol (Textbox) read-only if the property name is PageName.
This is what we do to remove a property from edit mode:
Subscribe to to the LoadedPageEventHandler,
in it we do this: e.Page.Property.Remove("propname")
Regards,
Morten
Hi,
i used
private void EditPanel_LoadedPage(EditPanel sender, LoadedPageEventArgs e)
{
e.Page.Property["PageName"].OwnerTab = anotherTabIndex;
}
In this way the user can't see the prorperty Name on the main Tab.
/Ivan
Hi,
i set the page name programmatically in the global.asax:
static void Instance_CreatingPage(object sender, EPiServer.PageEventArgs e)
{
e.Page.PageName ="xxx"
}
This works fine but i need to disable\hide the filed(property) name in edit mode to prevent the user to change the text.
I tried
static void Instance_LoadingPage(object sender, EPiServer.PageEventArgs e)
{
e.Page.Property["PageName"].DisplayEditUI = false;
}
but it doesn't work.
Suggestions?