Click here to Skip to main content
14,484,183 members
Rate this:
Please Sign up or sign in to vote.
I have a image in Grid View and i want to set the maximum size(resolution) of that, i want to keep the size auto but also fix the maximum size. How can i do this?
Posted
Updated 30-Aug-17 1:31am
v2
Comments
Richard C Bishop 11-Apr-13 12:27pm
   
You cannot have your cake and eat it too.
Rate this:
Please Sign up or sign in to vote.

Solution 1

You can set the maximum size in CSS:
img.InGrid
{
max-width: 50px;
max-height: 50px;
}

It will let the image auto-size until it reaches one of those dimensions.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

set a style for the image

<asp:Image ID="Image1" runat="server" style="max-height:1000px;max-width:900px;height:auto;width:auto;" />
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100