More in this section

Forums / Developing with Sitefinity / Changing the Size of Poll Result Images

Changing the Size of Poll Result Images

2 posts, 0 answered
  1. Armysniper
    Armysniper avatar
    126 posts
    Registered:
    03 Mar 2005
    01 Sep 2009
    Link to this post
    I am looking at the PollBox and ResultsBoxNoLegend External Templates and I cannot find out how to reduce the space between the poll title and the poll question, and to reduce the size of the result images. Is there way to do this in the control or the template?
  2. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    01 Jun 2017
    02 Sep 2009
    Link to this post
    Hi Armysniper,

    In order to reduce the space in the PollBox control you can try replacing the "sf_pollQuestionsList" class used in the PollBox template with your own version. Now reducing the images size is more tricky. Since they are created on demand by the RadChart control. The only way to get them on the server is to create your own version of the PollBox control. However there is another simpler way by using JavaScript code on the cliend-side.
    Here is an example, just add it at the bottom of the ResultsBoxNoLegend template.
    <script type="text/javascript"
        this.ResizeImage(); 
        function ResizeImage() { 
            var allDIVs = document.getElementsByTagName('div'); 
     
            for (i = 0; i < allDIVs.length; i++) { 
                var idStr = String(allDIVs[i].id); 
                if (idStr.endsWith('Chart')) { 
                    var chartDiv = allDIVs[i]; 
                    var img = chartDiv.childNodes[1]; 
                    img.setAttribute('width''20'); 
                    img.setAttribute('height''20'); 
                } 
            } 
             
        } 
         
        String.prototype.endsWith = function(str) 
        { return (this.match(str + "$") == str) } 
    </script> 

    Please note that this is done for simple 3 answers poll and in you version the img search may be different so you will have to modify it to match.

    Hope this helps.

    Regards,
    Nikolai
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered