web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Portals 7.0.0021: ChildNavigation.ascx

(0) ShareShare
ReportReport
Posted on by 3,995

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

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans