Hello:
Running Portals 7.0.0021 on CRM 2016. Am attempting to modify the code Adx created for rendering the child pages on a web page. I am trying to make it a tiled view with thumbnails and am having a problem with the image part.
In the Web Page form for each of my web pages, the Image URL field is filled in with a path to an image loaded in Web Files (example: /displayproducts.png).
Here is my ASP.net code:
<% foreach (var node in Children) { %>
<div class="col-md-4">
<div><a href="<%: node.Url %>"><img src='<%: GetImage(node) %>' /></a>
<div><h4><%: node.Title %></h4></div>
<div style="height:125px"><h5><%= GetDescription(node) %></h5></div>
<div style="margin-bottom:10px"><a href="<%: node.Url %>" class="btn btn-primary" role="button">Learn More <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span></a></div></div>
</div>
<% } %>
And here is the function I wrote in the code behind:
protected object GetImage(SiteMapNode node)
{
if (node == null)
{
return null;
}
var entityNode = node as CrmSiteMapNode;
if (entityNode == null || entityNode.Entity == null)
{
return "displayproducts.png";
}
var entity = XrmContext.MergeClone(entityNode.Entity);
switch (entityNode.Entity.LogicalName)
{
case "adx_communityforum":
return Html.TextAttribute(XrmContext, entity, "adx_description");
case "adx_shortcut":
return Html.HtmlAttribute(XrmContext, entity, "adx_description");
case "adx_blog":
case "adx_event":
case "adx_webfile":
case "adx_webpage":
return Html.HtmlAttribute(XrmContext, entity, "adx_imageurl");
default:
return "displayproducts.png";
}
}
None of the images appear though, just the X trying to load it.
When I view the source of the page in Internet Explorer, it is pulling the data I have in the field in CRM, but there is a bunch of other code getting added around it:
<div><a href="/display-products/oled/"><img src='<div class="xrm-editable-html xrm-attribute"><div class="xrm-attribute-value">/displayproducts.png</div></div>' /></a>
Is there a way to make this work so I can display the image too?
Thank you.
-Joe
*This post is locked for comments