This project is read-only.

Shape rendering explanation

Topics: Writing modules
Nov 22, 2011 at 6:06 PM

I'm wondering if someone can help me understand the behavior I'm seeing by possibly explaining the difference between 2 different shape rendering methods.

I think I'm probably one of the few using Telerik MVC controls in my module and while I've gotten them to work, there are quirks here and there. The first being that Telerik as a ScriptRegistrar tag that has to be placed in the Layout file for the theme. This seems to be the only place it works. What the ScriptRegistrar does in essence is look for any @Html.Telerik() tags on the page and then dynamically includes the required .js files as well as create the jQuery initialization scripts and places them on the page.

All of this works great in a standard View with Telerik controls in it and also when calling a shape directly from a Controller when the shape template has Telerik controls in it: i.e.

return new ShapeResult(this, Shape._shapeTemplateName(dataCallHere));

Where I have found it doesn't work, is when passing multiple shapes to a View and then rendering those shapes using shape templates in specified zones. i.e.


var shapeModel = Shape.shapeName(Shape1: Shape.shapeTemplateName(dataCallHere)), Shape2: Shape.shapeTemplateName(dataCallHere)));
return View(shapeModel);


@{Layout.TripelFirst.Add(Model.Shape1, "1");}
@{Layout.TripelThird.Add(Model.Shape2, "1");}

For some reason, the Telerik ScriptRegistrar isn't picking up the @Html.Telerik() tags in the shape templates (_shapeTemplateName), and therefore not including the required .js files or initiating the controls in jQuery.


Does anyone know how the rendering of the shapes is different between calling a shape directly from the Controller as opposed to in the View as I listed above that might cause the Telerik ScriptRegistrar to not realize the @Html.Telerik() tags are present?

Thanks for any insight you can provide.

Nov 22, 2011 at 6:15 PM

You should try to put some breakpoint in there to find in what order things happen and if there's a difference in both cases.

Nov 22, 2011 at 7:14 PM

I'll give that shot and see what I can find...thanks Betrand