Try our conversational search powered by Generative AI!

Unable to get tag from ViewData

Vote:
 

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

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


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?

#145346
Mar 02, 2016 11:55
Vote:
 

Gone with fix here.

#145351
Mar 02, 2016 12:15
* 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.