|
 |
aspx thread: Specifying Size in an ASP:Image tag
Message #1 by "Hugh McLaughlin" <hugh@k...> on Mon, 29 Apr 2002 20:40:43
|
|
Hello everyone and thanks for your help in advance. In a standard <img>
tag, you can specify both the height and width of an image, but it
appears you cannot do the same in an ASP:Image tag. How can you specify
the size? Do you have to go through some type of sizing algorith? Any
help would be greatly appreciated. Thanks.
Message #2 by Scott Mitchell <mitchell@4...> on Mon, 29 Apr 2002 13:38:04 -0700
|
|
I think you have to set it via the Attributes array, like so:
<script language="vb" runat="server">
sub Page_Load(sender as Object, e as EventArgs)
imgPic.Attributes("Width") = 10
imgPic.Attributes("Height") = 10
end sub
</script>
<asp:image id="imgPic" runat="server" ImageUrl="mmc.gif" />
You can also do it like:
<asp:image id="imgPic" runat="server" ImageUrl="mmc.gif" width="10"
height="10" />
In an uplevel browser it will render as:
<img id="imgPic" src="/mmc.gif" border="0" style="width:10px;" />
in a downlevel browser it will render as:
<img id="imgPic" src="/mmc.gif" border="0" width="10" />
Happy Programming!
Scott Mitchell
mitchell@4...
***********************************************************
Looking to learn ASP.NET? Look no further than:
Sams Teach Yourself ASP.NET in 21 Days
http://www.amazon.com/exec/obidos/ASIN/0672321688/4guysfromrollaco
***********************************************************
| -----Original Message-----
| From: Hugh McLaughlin [mailto:hugh@k...]
| Sent: Monday, April 29, 2002 8:41 PM
| To: ASP+
| Subject: [aspx] Specifying Size in an ASP:Image tag
|
|
| Hello everyone and thanks for your help in advance. In a
| standard <img>
| tag, you can specify both the height and width of an image, but it
| appears you cannot do the same in an ASP:Image tag. How
| can you specify
| the size? Do you have to go through some type of sizing
| algorith? Any
| help would be greatly appreciated. Thanks.
|
|
 |