Technical support This forum is closed.
Version 1.x > Technical support > Tip for referring to images View modes: 
User avatar
Member
Member
cpaul - 4/15/2005 10:57:31 PM
   
Tip for referring to images
I'm using WilsonMasterPages for the overall template of my site, since it's being redesigned as I implement the new solution, and since I had problems using the ASP 2.0 CTP release with Kentico.

Inside the masterpage controls, it won't let you use <%=...%> tags where you could put a ResolveUrl, so I made a simple wrapper of image and imagebutton that do this. The normal <asp:Image> tags get confused by the url rewriting engine when they try to make themselves relative to the master page user control template, and this is the only way I could find to get the images to always be right.

Below is the code for the image control (the ImageButton is the same with different parent class). This might be something easy you could add to the CMS controls in the next release, or included in the documentation for KB0002.

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

namespace My.WebControls
{
/// <summary>
/// Summary description for Image.
/// </summary>
public class Image : System.Web.UI.WebControls.Image
{

/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
protected override void Render(HtmlTextWriter output)
{
this.ImageUrl = ResolveUrl(this.ImageUrl);
base.Render(output);
}
}
}

To use it, register a tag prefix and then use it exactly like a normal <asp:Image> tag. Hope this helps someone.

User avatar
Guest
admin - 4/15/2005 11:09:29 PM
   
Re: Tip for referring to images
Hi Chip, thank you very much for this useful tip! We will certainly add it to the knowledge base and we will consider how we could add it to the Kentico CMS Controls library.

Best Regards,

User avatar
Member
Member
wtijsma - 4/18/2005 1:47:55 PM
   
Re: Tip for referring to images
Thanks...

Paul, are you working with the source code version? Do you think it can be done in 2-3 days to get KenticoCMS ready for 2.0? I'm planning on doing the same...

Wiebe

User avatar
Member
Member
cpaul - 4/18/2005 4:15:48 PM
   
Re: Tip for referring to images
Wiebe,

No I'm not working with the source version, and as such I'm not really sure what it will take to get Kentico ready for Asp 2.0. There's one small thing that's an easy fix, where there is a namespace clash between TreeProvider or some similar structure that I fixed by quantifying the names, but the actual cmsdesk portion didn't work right, so I went back to 1.1.

When creating a new document, the javascript or whatever that tied the popup window wherein you select the page template would not populate the parent window value. I didn't look into why this happened and just took it as a hint I might be getting too bleeding edge =)

-Chip

User avatar
Guest
admin - 4/23/2005 6:04:57 PM
   
Re: Tip for referring to images
Hi Chip,

Thank you for your post. We currently do not support ASP.NET 2.0, but we certainly plan to do so as soon as the final version is released.

Best Regards,