Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anders Burla 2560 posts 8256 karma points
    Feb 18, 2011 @ 17:47
    Anders Burla
    0

    Making data available to razor in templates

    As razor is getting more and more attention im looking for a way to expose our data in Tea Commerce to the razor people to work with. Today we have an xslt extension called GetCurrentOrderXml which gives the developer the possibility to use it in their xslt macro. But I want to make the same data available to the razor people. But how to do that?

    We have a public method called GetCurrentOrder which returns an Order object. Could that be used in Razor and if yes - how?

  • Jonas Eriksson 930 posts 1825 karma points
    Feb 18, 2011 @ 18:10
    Jonas Eriksson
    1

    Hi, I haven't used Tea Commerce (yet), but razor can be used just like an ascx with a cleaner syntax (and without codebehinds). So you should be able to do any c# like:

    @using TeaCommerceNameSpace
    @{
    var order = GetCurrentOrder();
    }
    <p>@order.CustomerName</p>
  • Anders Burla 2560 posts 8256 karma points
    Feb 19, 2011 @ 16:23
    Anders Burla
    0

    Cool I will try that!

Please Sign in or register to post replies

Write your reply to:

Draft