You render images just like in any aspx page. Not sure what you are after but you can have a specific user control hook on all images if you like that as well by adding a user control whit a backend looking something like this:
TemplateDescriptor(Inherited = true)] public partial class ImageControl : ContentControlBase<imagedata> { protected Injected<urlresolver> UrlResolver { get; set; } protected string ImageUrl { get { return UrlResolver.Service.GetUrl(CurrentData.ContentLink); } } }
YA BUT I WANT RENDER CODE BEHIND
using EPiServer;
using EPiServer.Core;
using EPiServer.Web.Mvc.Html;
using EPiServer.Web.WebControls;
using EpiserverCMS8.Models.Pages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EpiserverCMS8.Models;
namespace EpiserverCMS8.Views.UserControls
{
public partial class MainMenu : UserControlBase<DefaultTemplate>
{
public string strSelectedPage = string.Empty;
public string siteHeading = string.Empty;
public string QueryString = string.Empty;
protected override void OnLoad(System.EventArgs e)
{
base.OnLoad(e);
PageReference pg = PageReference.StartPage as PageReference;
PageData pd = GetPage(pg);
siteHeading = Convert.ToString(pd.Property["SiteHeading"]);
//PageReference pdg = CurrentPage.PageLink as PageReference;
logopc.ImageUrl = Convert.ToString(pd.Property["Logotype"]);
//logopc.ImageUrl = UrlExtensions.(pd.Property["LogoType"]) ?? string.Empty;
logopc.NavigateUrl = "/en/";
logomobile.ImageUrl = Convert.ToString(pd.Property["Logotype_mob"]);
logomobile.NavigateUrl = "/en/";
QueryString = "";
Menu.PageLink = PageReference.StartPage;
Menu.PageLoader.GetChildrenCallback = new HierarchicalPageLoader.GetChildrenMethod(LoadChildren);
Menu.DataBind();
}
private PageDataCollection LoadChildren(PageReference pageLink)
{
PageDataCollection pages = DataFactory.Instance.GetChildren(pageLink);
// int no = pages.IndexOf("Library");
int PagesCount = pages.Count;
PagesCount = PagesCount - 8;
//pages.RemoveRange(6, PagesCount);
// pages.Insert(0, DataFactory.Instance.GetPage(pageLink));
return pages;
}
}
}
ABOUE BOLD TAG IMAGE CODE NOT WORKING
Suresh. If you want answer to your question you have to start to be more gentle and not screaming (writing with capital letters is to scream).
You have the answer in your other thread:
http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=120648&epslanguage=en
how can i render image in user control tell me guys urgent i need