Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Need some help on absolute image referencesNeed some help on absolute image references
Previous
 
Next
New Post
6/9/2006 10:00 AM
 

i need some help in understanding the way DNN handles references to e.g. images. I have a DataList control that render some images. One of the controls is a imageUrl that I set on my Editxxx.ascx page. That one renders fine because i use the DNN controls. "controls/URLControl.ascx". That one works fine. However on this page i also want to render an image I get from the Portals/0/Images/ folder. At first i thought its just a simple /Portals/0/Images/myImage.gif but then i saw that image only renders when i am not log in as host. The moment i log in as host something like "Home/tabid/36" gets append to the string to make it http://localhost/DotNetNuke_2/Home/tabid/36/Portals/0/Images/myImage,gif and that does not work. I tried ../../../ references to but still no luck. I have some images in my css files that i am experiencing the same problems with

Below is my ascx file. Please note the the following line (<img src="Portals/0/Images/<%# AE.Modules.Promotions.PromotionsController.GetStaticProduct((Int32)Eval("ProductId")).Manufacturer %>.png)

<%@ Control language="C#" Inherits="AE.Modules.Promotions.ViewPromotions" CodeFile="ViewPromotions.ascx.cs" AutoEventWireup="true"%>

<%@ Register TagPrefix="dnn" TagName="Audit" Src="~/controls/ModuleAuditControl.ascx" %>

<asp:datalist id="lstContent" datakeyfield="ItemID" runat="server" RepeatDirection='Horizontal' RepeatColumns='2' cellpadding="4" OnItemDataBound="lstContent_ItemDataBound">

<itemtemplate>

<div class="div_leftbanner">

<div class="div_imagepanel">

<img src='<%# AE.Modules.Promotions.PromotionsController.GetStaticProduct((Int32)Eval("ProductId")).ProductImage %>' alt="Canon lence" class="img_banner" width="110" height="113" />

</div>

<img src="Portals/0/Images/<%# AE.Modules.Promotions.PromotionsController.GetStaticProduct((Int32)Eval("ProductId")).Manufacturer %>.png" alt="Canon" class="img_titlebanner" width="60" height="15" />

<h3><%# Eval ("Title") %>

<asp:HyperLink ID="HyperLink1" NavigateUrl='<%# EditUrl("ItemId",((int)DataBinder.Eval(Container.DataItem,"ItemId")).ToString()) %>' Visible="<%# IsEditable %>" runat="server"><asp:Image ID="Image1" Runat='server' ImageUrl="~/images/edit.gif" AlternateText="Edit" Visible="<%# IsEditable%>" resourcekey="Edit"/></asp:hyperlink>

<asp:Label ID="lblContent" runat="server" CssClass="Normal"/></h3>

<p><%# Server.HtmlDecode(((AE.Modules.Promotions.PromotionsInfo)Container.DataItem).Description)%></p>

<div class="div_readmorepanel">

<a href="#"><img src="Portals/0/Images/readmorebtn.gif" alt="Read More button" class="readmorebtn" /></a>

</div>

</div>

</itemtemplate>

</asp:datalist>

 

 

 
New Post
6/9/2006 5:53 PM
 

Although I can't give you the full solution, I can tell you that you need to look at using DNN's ResolveUrl() function.  Probably better served over in the programming sections of the forum.

Hope this helps...

 
New Post
11/10/2007 3:36 AM
 

In the src-attribute of the img element, you can use a "~" to represent your website's root. So in your case, you could use

<img src="~/portals/0/images/readmorebtn.gif" />

Hope this helps.


Web applications, DNN websites, modules, skins and support
 
New Post
11/10/2007 6:54 AM
 

This won't work, it is no server control, use asp:image instead

 
New Post
11/10/2007 8:02 AM
 

Darn, you're right. Thanks.


Web applications, DNN websites, modules, skins and support
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Need some help on absolute image referencesNeed some help on absolute image references


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out