Quantcast
Channel: Optimizely Search & Navigation
Viewing all articles
Browse latest Browse all 6894

Controller with TemplateDescriptor for Block without Controller not working.

$
0
0

Hi, I have a Block without controller. I want to create a Tag based contoller using TemplateDescriptor feature. This is code for the controller with tag.

[TemplateDescriptor(
    AvailableWithoutTag = false,
    ModelType = typeof(FaqBlock),
    Tags = new[] { CmsFeatureTemplateTags.ProductFaqs })]
public class FaqBlockProductFaqsController : BlockController<FaqBlock>
{
    public override ActionResult Index(FaqBlock currentContent)
    {
        return this.View("~/Views/Content/FaqBlock/ProductFaqs.cshtml", currentContent);
    }
}

Here Tag name value is

  public const string ProductFaqs = "ProductFaqs";

View template for the default block is working, but when I created a controller with TemplateDescriptor the controller is not hitting.

Here I added Tag to render that, this isn't hitting controller with Tag and not event rendering the default view template.

@Html.DisplayFor(x => Model.ContentArea, new { Tag = CmsFeatureTemplateTags.ProductFaqs})

Any thoughts?


Viewing all articles
Browse latest Browse all 6894

Trending Articles