Thanks Ivan,
I added the logic for the url resolve, but still it is not displaying anything.
Here is the code in the class file
using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Collections;
using System.ComponentModel;
using Telerik.Cms.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Telerik.Blogs.WebControls;
using Telerik.Cms.Engine;
using Telerik.Framework.Web.Design;
using Telerik.Lists.PersistentObjects;
namespace Telerik.Blogs.WebControls
{
public class CustomBlogPosts : BlogPosts
{
public override string SingleItemTemplatePath
{
get
{
object obj = this.ViewState["SingleItemTemplatePath"];
if (obj != null)
return (string)obj;
// otherwise return default path of the SingleItem Template. This should
// be the path of the new template we have created
return "~/Sitefinity/Admin/ControlTemplates/Blogs/Modes/ListPageDetail.ascx";
}
set
{
this.ViewState["SingleItemTemplatePath"] = value;
}
}
public override string ItemListTemplatePath
{
get
{
object obj = this.ViewState["ItemListTemplatePath"];
if (obj != null)
return (string)obj;
// otherwise return default path of the ItemList Template. This should
// be the path of the new template we have created
return "~/Sitefinity/Admin/ControlTemplates/Blogs/Modes/ListPageMaster.ascx";
}
set
{
this.ViewState["ItemListTemplatePath"] = value;
}
}
private string GetItemUrl(string val)
{
if (val.StartsWith("~/"))
return this.ResolveUrl(val);
if (val.StartsWith("["))
{
int idx = val.IndexOf("]");
string provider = val.Substring(1, idx - 1);
string strId = val.Substring(idx + 1);
Guid id = new Guid(strId);
if (ContentManager.Providers.ContainsKey(provider))
{
IContent cnt = ContentManager.Providers[provider].GetContent(id);
if (cnt != null)
return VirtualPathUtility.ToAbsolute(cnt.UrlWithExtension, this.Context.Request.ApplicationPath);
}
}
return val.ToString();
}
protected override void SetItemMetadata(System.Web.UI.Control itemContainer, Telerik.Cms.Engine.IContent contentItem)
{
base.SetItemMetadata(itemContainer, contentItem);
Image img = (Image)itemContainer.FindControl("Image1");
if (img != null)
{
string thumb= GetItemUrl((string)contentItem.GetMetaData("Thumbnail"));
img.ImageUrl = thumb;
img.AlternateText = "This is from the class file";
}
}
}
}
I also tried commenting the Image url and just displaying AlternateText, but did not display that. I feel it is not reaching this part of the code.
Thank you,
Jay Mehta.