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

What are my options for getting rid of the "Name" field when creating a new page?

Vote:
 

I have a couple Page Types where the PageName is derived from other properties and should really be automatic.  For instance, one Page Type has a "First Name" and "Last Name" property.  So, the PageName should just be "Last Name, First Name" in all cases.  Another one has a "Year" and a "Month" property, so the PageName should always be "Year-Month."

Now, I know I can hook various page creation events and set the PageName from there.  But the user still has to enter a name in a textbox in the interface.  This seems pointless, and potentially confusing since I'm going to adjust it programatically anyway when they save it.

Is there some way to prevent the "Name" field from appearing?  I'd be happy with disabling it. However, it does require input, and I don't know if there's anyway I could shortcut the validator, so my thought is that I could just diable it and put "[Auto]" in the field or something.

Has anyone done this before?  I can't imagine I'm the first one who wants to do this.

#42806
Sep 02, 2010 7:44
Vote:
 

Try adding this to your global.asax.cs file:

protected void Application_Start(Object sender, EventArgs e)
{
    EPiServer.UI.Edit.EditPanel.LoadedPage += new EPiServer.UI.Edit.LoadedPageEventHandler(EditPanel_LoadedPage);
}
private void EditPanel_LoadedPage(EPiServer.UI.Edit.EditPanel sender, EPiServer.UI.Edit.LoadedPageEventArgs e)
{
    e.Page.Property["Pagename"].DisplayEditUI = false;
}

/Linus

#42807
Sep 02, 2010 8:07
Vote:
 

Wow.  Linus, thank you.  It works perfectly.

#42832
Sep 02, 2010 15:18
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.