Copied to clipboard

Flag this post as spam?

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


  • Rajan 9 posts 29 karma points
    Nov 16, 2012 @ 11:13
    Rajan
    0

    How to use web service inside Razor

    Hi,

    Earlier i was displaying some webservice data inside umbraco site by creating Macro using usercontrol.
    In usercontrol i am getting data form webservice and using that usercontrol for creating Macro.

    Now my client is saying that he doesn't want to create macro using usercontrol, he want to create using Razor.

    So can anyone please guide me how to use webservice inside Razor for displaying data.

    Thanks in advance.

    Rajan

     

  • Kevin Lawrence 183 posts 350 karma points
    Nov 16, 2012 @ 12:36
    Kevin Lawrence
    0

    Yes this is possible and the c# code itself will be almost identical.  In the top of your razor you would declare a code block:

    @{

    // Write code that gets data from web-service here.

    }

    <!-- Render HTML from web-service data here using variables declared above -->

    Does that make sense?

Please Sign in or register to post replies

Write your reply to:

Draft