Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
50
Image size overriding WebImageViewer.Height in some browsers
posted

I'm using the 12.1 controls with .net 4.

I've set the Height of the WebImageViewer control to 100 pixels, but if I add an image that doesn't fit in the control, the control will grow to fit the image on some browsers (Chrome, Firefox, Safari). Is there any way to make it keep the controls Height without resizing all of the images that I am feeding it?

Thanks for you help.

Parents
  • 50
    Verified Answer
    posted

    I found some code that lead me down the path to the answer that I was looking for.

    I set an event handler up for the Initialize event of the WebImageViewer and called it WebImageViewer1_Initialize.  The following javascript function sets the image height to 90 pixels.

     

    function WebImageViewer1_Initialize(sender, eventArgs)
    {	
        var itemsCollection = sender.get_items();
        var itemsCount = itemsCollection.get_length();
        for (var i = 0; i < itemsCount; i++) {
            var imageItem = itemsCollection.getItem(i);
            imageItem.get_element().style.height = "90px";
        }
    }

     

Reply Children
No Data