SaaS CMS has officially launched! Learn more now.

Can we select property Name based on the condition under "EPiServer:PageTre"


Hi ,

I want to choose "PropertyName" based on the condition to use in "<EPiServer:Property ID="Property1" PropertyName="WindowTitle" runat="server" />"

for ex: first i want to get "MenuTitle" if it will be null then it should take some other value ie:WindowTitle or PageName as "PropertyName"

is it possible to do so.

Your help will be highly appreciated...

Thanks in Advance. 

Sep 16, 2011 9:23

If it is just a simple text property it is probably easiest to write some code directly in the item template, or create a method in codebehind to which you pass the Container.CurrentPage for processing.

If you really want to use the property control you can do something similar by putting your logic in a method which returns the property name. I haven't tried this, but I thing it might work.


<EPiServer:Property PropertyName="<%# GetPropertyName(Container.CurrentPage) %>" runat="server" />

in codebehind:

protected string GetPropertyName(PageData page) { // logic which selects property name goes here}

Or directly in markup with fallback from MenuTitle to WindowTitle for example:

<EPiServer:Property PropertyName="<%# Container.CurrentPage["MenuTitle"] == null ? "WindowTitle" : "MenuTitle" %>" runat="server" />

Sep 16, 2011 12:43
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.