开发者

jQuery templates and partial views

I have an ASP.NET MVC 2 website that I am starting to use jQuery Templates on. I love them and they work great, but I am trying to add this to a listing that contains a partial view. I know they effectively solve the same issue, except that I need both.

<script id="ListingTemplate" type="text/x-jquery-tmpl">
    <div>
        <% Html.RenderPartial("Listing", {{ID}}); %>
    </div>
</script>

This fails as {{ID}} is not an ASP.NET variable and I cannot find a开发者_高级运维 way to get this to resolve. I would like to use a workflow like this rather than attempt to rewrite my partial logic in JS.


jquery templates run on the client side. Html.RenderPartial on the server, much before any client side code has the chance to execute. The whole purpose of jquery templates is not to use any server side html, but to define the template purely on the client side.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜