Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Setting default value to Name of page?



I am trying to set one of my fields to default to the name of the page item created.  The field is for breadcrumb title, so it logically makes sense to default this to the page name.

I've tried overriding SetDefaultValues on my Page model, but it seems that this function is called before the user is prompted for the page name.

Is this possible in episerver?

Jul 03, 2018 20:45

Previously to do this I have needed to hook up on the ContentCreated event (or if it was ContentCreating, unfortunately I don't remember).

Unless in your view model you create a fallback so if the Breadcrumb does not have a value, use the Page Name instead.

Jul 03, 2018 22:41

Hey, Dylan,

Given that you already have the value for PageName that breadcrumb name should fallback too, I wouldn't write the same value to the database, but rather do what Alf proposed. When getting the breadcrumb, have something like BreadcrumbName ?? PageName.

If it was more complex than that, if you had some difficult logic to choose the BreadcrumbName, Creating or Publishing would do the work (since in these events, the content is writable). However, "BreadcrumbName ?? PageName" will hardly give you any performance reason to do that.


Jul 08, 2018 15:49

Thanks!  This makes sense!

Jul 09, 2018 14:49
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.