Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Unable to get tag from ViewData

$
0
0

So I have a block (controller + view) that has a TemplateDescriptor attribute:

[TemplateDescriptor(AvailableWithoutTag = true, Tags = new []{"NoForm"})]
public class SearchBookBlockController : BlockController<SearchBookBlock>


For certain pages, the block is added onto pages via a dedicated block type property, not a ContentArea. This is because I want control over exactly where its rendered. To redner the block I'm using the following:

View A:

@{ Html.RenderContentData(Model.CurrentPage.SearchBookBlock.GetContentData(), false, "NoForm"); }

View B:

@{ Html.RenderContentData(Model.CurrentPage.SearchBookBlock.GetContentData(), false); }

I want to know if the action in my controller was triggered with the "NoForm" tag or not, but the following is always null:

ControllerContext.ParentActionViewContext.ViewData["tag"]

Any one any ideas?
Am I better just using Html.Action in this case?


Viewing all articles
Browse latest Browse all 9076

Trending Articles