views:

193

answers:

1

I'm working with Telerik's MVC Tabstrip control and am having an issue, although I suspect the issue is more my ignorance of how to properly use Lambda expressions and MVC helpers and not really Telerik-specific.

My helper call is this:

<% Html.Telerik().TabStrip()
        .Name("BusinessDetailsTabs")
        .Items(parent =>
        {
            parent.Add()
                .Text("Facilities")
                .Content(() =>
                {%>
                    <%= Html.RenderPartial("~/Views/Shared/DisplayTemplates/BusinessRelations/FacilityGrid.ascx", new FacilitiesViewModel {Entities = Model.Facilities}) %>
                <%});

        })
        .Render();
%>

The problem is that the Add().Content method's signature is Content(string foo) and apparently the way I'm calling the RenderPartial, it's just not working - I get this exception: Compiler Error Message: CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type

How can I fix this so that I can still call this partial method? I have looked around and found a RenderPartialToString method but that sounds like a hack and it seems like this has a better solution than that.

+3  A: 

Change to

<% Html.Telerik().TabStrip()
        .Name("BusinessDetailsTabs")
        .Items(parent =>
        {
            parent.Add()
                .Text("Facilities")
                .Content(() =>
                {
                    Html.RenderPartial("~/Views/Shared/DisplayTemplates/BusinessRelations/FacilityGrid.ascx", new FacilitiesViewModel {Entities = Model.Facilities});
                });

        })
        .Render();
%>
Gregoire
Awesome, that's it! Thanks a ton! (and apparently SO won't let me accept your answer for another 9 minutes... grr...)
Jaxidian