Try our conversational search powered by Generative AI!

TemplateCoordinator and AvailableWithoutTag property

Vote:
 

Hi,

In AlloyTech website, I've created a new block called EmployeeBlock.
I've created a block controller and accompanying partial view.

After that I opened Business / Rendering / TemplateCoordinator.css and added the following lines:

viewTemplateModelRegistrator.Add(typeof(EmployeeBlock), new TemplateModel
{
    Name = "EmployeeOnStartPage",
    Tags = new[] { "StartPage" },
    AvailableWithoutTag = false,
    Path = BlockPath("EmployeeBlockOnStartPage.cshtml")
});

viewTemplateModelRegistrator.Add(typeof(EmployeeBlock), new TemplateModel
{
    Name = "EmployeeOnAboutUsPage",
    Tags = new[] { "AboutUsPage" },
    AvailableWithoutTag = false,
    Path = BlockPath("EmployeeBlockOnAboutUsPage.cshtml")
});



This works fine when I use Tag value in PropertyFor helper:
@Html.PropertyFor(x => x.MainContentArea, new { Tag = "StartPage"})

But if I exclude Tag or enter undefined tag, EPiServer will display a partial view (Views / EmployeeBlock / Index.cshtml) instead of throwing an exception:

@Html.PropertyFor(x => x.MainContentArea)
@Html.PropertyFor(x => x.MainContentArea, new { Tag = "LoremIpsumDolor"})

What's the purpose of AvailableWithoutTag property then?

Thank you!

#115819
Jan 19, 2015 16:41
* 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.