November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
You can hopefully get some more information if you turn on log4net logging on debug level for EPiServer.Web.TemplateResolver.
If you take in a dependency to TemplateResolver somewhere you can probably do something like this to help you debug.
var Template = _templateResolver.Resolve(httpContext, typeof(KeepUpdatedBlock), currentBlock, TemplateTypeCategories.MvcPartial, YourRenderingTag);
Thanks. I had some weirdness going on in my viewengine, that weren't visible in 7.0. Solved now!
Beaware that if your block type name matches view name - your controller may have been omitted. You would need to decorate that with TemplateDescriptor or implement IRenderTemplate<T> somehow, or name your view as partial (for instance starting with "_") and return view from controller explicitly.
Hi Thomaz, How did you resolved this issue. I got an error like yours today under upgrading. Could you give me a clue?
Thanks.
T.Dzung
TDLA. I also just run into this and doing like Valdis said helped me. Meaning that I renamed my block to start with a _ (common MVC naming).
Thank you Henrik! I just did like you/Vadis said and the error are gone, it's working! :-)
We encountered this exact problem too, and Valdis answer gave the solution.
Maybe this should be changed so that the if you have created a custom controller for a block it is used even if there is a view matching the name?
I'm upgrading to 7.5 and having some issues getting a block to work. I have a local block in a page type such as:
1
public
virtual
KeepUpdatedBlock KeepUpdated {
get
;
set
; }
I render it using:
1
@Html.PropertyFor(x => x.CurrentPage.KeepUpdated)
The block has a controller:
01
public
class
KeepUpdatedController : BlockController<KeepUpdatedBlock>
02
{
03
public
override
ActionResult Index(KeepUpdatedBlock currentBlock)
04
{
05
KeepUpdatedViewModel model =
new
KeepUpdatedViewModel()
06
{
07
...
08
};
09
10
return
PartialView(
"KeepUpdatedBlock"
, model);
11
}
Problem is, the controller is not obviously not used and I can't figure out why.
The model item passed into the dictionary is of type 'Castle.Proxies.KeepUpdatedBlockProxy', but this dictionary requires a model item of type 'xxx.Web.Models.ViewModels.KeepUpdatedViewModel'.
Clues?