Copied to clipboard

Flag this post as spam?

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


  • Max 144 posts 166 karma points
    Apr 22, 2011 @ 10:38
    Max
    0

    calling umbraco:Item item in c# inline code

    Hi Have a field

    <img id="vesselImg"  src='<umbraco:Item field="vesselimage" runat="server" ></umbraco:Item>' > in a template page

    If i try to put runat="server"  tag in the <img i can work on it in the code

    <script language="C#" runat="server">
     vesselImg.tostring() //i can call it here

    </script>

    but when i put runat="server" like this

    <img id="vesselImg"  runat="server" i cant see the image in runtime it shows and error

    is there another option for me to get

    <umbraco:Item field="vesselimage" runat="server" ></umbraco:Item> in the code durign runtime

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 22, 2011 @ 10:42
    Jan Skovgaard
    1

    Hi Max

    I really don't think that inline C# in the template is the way to go.

    Try having a look at the inline XSLT samples in this wiki instead: http://our.umbraco.org/wiki/reference/templates/umbracoitem-element/inline-xslt

    This should do the trick for you I think.

    Hope this helps.

    /Jan

  • Max 144 posts 166 karma points
    Apr 22, 2011 @ 11:12
    Max
    0

    i cant use  a macro in this case i just a neeed a solution to get the umbraco field item for rendering it at runtime

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 22, 2011 @ 11:25
    Jan Skovgaard
    0

    Hi Max

    It's not a macro...it's inline XSLT so you don't need to create one.

    But this won't cut it?

    /Jan

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 22, 2011 @ 14:09
    Tom Fulton
    0

    Not sure exactly what you are trying to achieve, but this post has an example of using nodeFactoy to get properties with C# inside a template.  I think Inline XSLT is easier though.  (Note it's changed to umbraco.NodeFactory if using 4.7)

  • Max 144 posts 166 karma points
    Apr 29, 2011 @ 14:05
    Max
    0

    the node factory is working thank you for your response

Please Sign in or register to post replies

Write your reply to:

Draft