Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8914143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:39:07+00:00 2026-06-15T04:39:07+00:00

I have a sitecore control like this: <sc:Image ID=imgLogo runat=server Field=Image/> Now the current

  • 0

I have a sitecore control like this: <sc:Image ID="imgLogo" runat="server" Field="Image"/>

Now the current item does not have an Image field. I am pulling the Item through droptree in CurrentItem like this (GetFieldValue is same as GetField. I am overriding the base class in Sitecore):

 string countryGuid = CurrentItem.GetFieldValue("Country", null); 
 Item country = sitecoreDatabase.GetItem(countryGuid);
 BindCountryLogo();

Now in this Item I have an image for the country logo. All I want to show up on the sc:Image.

So far I got this:

 private void BindCountryLogo(Item country)
    {
        Fields.ImageField logoField = country.Fields["Image"];
        if (logoField != null && logoField.MediaItem != null)
        {
            //Sitecore.Data.Items.MediaItem image = new MediaItem(logoField.MediaItem);
            //string src = Sitecore.Resources.Media.MediaManager.GetMediaUrl(image);
            //imgLogo.DataSource = src;
            //imgLogo.ImageUrl = logoField.MediaItem.Source.;
            //string src = Sitecore.StringUtil.EnsurePrefix('/', Sitecore.Resources.Media.MediaManager.GetMediaUrl(logoField));
            //Sitecore.Data.Items.MediaItem img = new MediaItem(ImageField.Medi)
        }
     }

None of them are working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:39:08+00:00Added an answer on June 15, 2026 at 4:39 am

    The control has a property “Item” which you can set to the item that holds the imageField.

    Your BindCountryLogo should look like this:

    private void BindCountryLogo(Item country)
    {
        imgLogo.Item = country;    
    }
    

    (Or remove the BindCountryLogo() method and set the Item in the main method 😉 )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Sitecore and have a multilist field I'd like to use Lucene to
I have a repeater which dynamically generate tab links using Sitecore (sc:Link) like this:
In Sitecore I have created a custom field (via this recipe: http://sdn.sitecore.net/Articles/API/Creating%20a%20Composite%20Custom%20Field/Adding%20a%20Custom%20Field%20to%20Sitecore%20Client.aspx ) The
I have a csv importroutine which imports my CSV values into Sitecore. After this
I have user control under Sitecore CMS. It has some controls bound to some
Does Sitecore have some sort of hardcoding regarding the website default site? i changed
I have an XSLT (running under Sitecore) that I'd like to benchmark. For example:
In my Sitecore 6.1.0 installation I have hooked onto the item:added event by implementing
In Sitecore 6, I have created a sublayout that has an asp:login control. For
I have a Sitecore content structure where any single item can have a number

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.