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,
In a masterpage, this if statement no longer works for 4.5.2
<% if(umbraco.library.GetItem("content") != ""){ %> <umbraco:Macro fieldname="content" Alias="Item" runat="server"></umbraco:Macro> <% } %>
Is there anything I'm overlooking? Thanks,
Thanks,
DT
What's it doing?
Try using string.IsNullOrEmpty rather than just checking ""
the result is always empty and nothing is returned
Hi Duc,
Could you post the macro content please?
Regards,Eduardo Macho
there is nothing in the macro, just some html
i'll try the suggestion from slace
Have you tried outputting the item using Response.Write(umbraco.library.GetItem("content"));
Cheers,
/Dirk
And also, check the trace output using ?umbdebugshowtrace=true and see if there's any exception logged!
I've had the same problem and so have other people (http://our.umbraco.org/forum/core/41-feedback/11602-How-to-use-umbracolibraryGetItem()-in-code-behind). The GetItem method will return the attributes of the node XML without any problem, but not any of the child elements.
@Pervez,
It will, but not if you're using the new schema, seems to code is not updated to check for use of the new xml schema introduced in v4.5+
Anyways, the solution suggested in the other thread is the way to go: use nodeFactory instead of GetItem()
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
if statement for umbraco.library.GetItem in a masterpage
Hi,
In a masterpage, this if statement no longer works for 4.5.2
<% if(umbraco.library.GetItem("content") != ""){ %>
<umbraco:Macro fieldname="content" Alias="Item" runat="server"></umbraco:Macro>
<% } %>
Is there anything I'm overlooking? Thanks,
Thanks,
DT
What's it doing?
Try using string.IsNullOrEmpty rather than just checking ""
the result is always empty and nothing is returned
Hi Duc,
Could you post the macro content please?
Regards,
Eduardo Macho
there is nothing in the macro, just some html
i'll try the suggestion from slace
Have you tried outputting the item using Response.Write(umbraco.library.GetItem("content"));
Cheers,
/Dirk
And also, check the trace output using ?umbdebugshowtrace=true and see if there's any exception logged!
Cheers,
/Dirk
I've had the same problem and so have other people (http://our.umbraco.org/forum/core/41-feedback/11602-How-to-use-umbracolibraryGetItem()-in-code-behind). The GetItem method will return the attributes of the node XML without any problem, but not any of the child elements.
@Pervez,
It will, but not if you're using the new schema, seems to code is not updated to check for use of the new xml schema introduced in v4.5+
Anyways, the solution suggested in the other thread is the way to go: use nodeFactory instead of GetItem()
Cheers,
/Dirk
is working on a reply...