Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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
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
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
It's not a macro...it's inline XSLT so you don't need to create one.
But this won't cut it?
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)
the node factory is working thank you for your response
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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
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
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
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
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)
the node factory is working thank you for your response
is working on a reply...