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?
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:
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!