Image (From library) user control for master page

Posted by Community Admin on 04-Aug-2018 13:44

Image (From library) user control for master page

All Replies

Posted by Community Admin on 17-Jun-2015 00:00

Hi, I'm wanting to display an image on a master page / user control and I want to reference by the library Image Id. I've found a "ImageControl" in the Telerik.Sitefinity.Web.UI.PublicControls namespace which seems to fit the bill but whenever I reference controls from this library the whole intellisense stops working and I can't get the parameters for this user control.

I also can't seem to find any documentation on working with controls directly on master pages / controls which is useful.

I've also tried importing the toolbox for this library and it does bring all the controls in but when I drop it on the page it tells me it doesn't recognise the tag prefix.

I would build all this in master pages in the admin area but I don't want 20 templates all with their own logo dropped onto them and equally any navigation etc so I'm putting these into Header and Footer controls.

I've read somewhere that you have to create custom controls to do what I'm wanting but that seems overkill if you already have the controls created which are rendered from the CMS?

Posted by Community Admin on 22-Jun-2015 00:00

Hi Chris,

I have replied in the ticket you have opened related to this. I am pasting the reply here for your convenience:

I have just tested this and managed to add the ImageControl to the master page. In order to register the control please note to add the following namespace in the master page:

<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.PublicControls" TagPrefix="sf" %>

Then you will be able to use the control the following way and set the ImageId property of the control to the id of the image you want to display:

<sf:ImageControl id="imageControl1" ImageId="D57BB09D-3061-65BF-89A0-FF0000058207" runat="server" />

Regarding the intellisense, please note that there is not available intellisense for the ImageControl widget in the markup. What I can suggest in order to inspect the properties of the control is to create an instance of the control in the code behind and then you will be able to review its properties:

ImageControl image = new ImageControl();
 
var imageId = image.ImageId;

Regards,
Sabrie Nedzhip
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 22-Jun-2015 00:00

Thanks, the intellisense was what was throwing me. I just wanted to make sure there wasn't something I could to to resolve it.

 I've used the object explorer to get the properties so I'll just work with that instead

 Thanks

This thread is closed