How to set the div Height & Width from within C#

  • Thread starter Thread starter Anton
  • Start date Start date
A

Anton

Hi

asp.net 3.5

I have this markup, The problem is that I want the border to go arround the
image. As the markup is now thediv fills entire space and the border comes
on the outside of that space.. I want the border to go arround the image so
I can show to the user how size of the image.

In the code I can get the pixels size of the image so I was wondering how to
set the div height & width programmatically?
I didn't see any height & width properites on the div

(I know I have to add a runat tag and an id in order to reference it from
servre code)

<div style="text-align:center; border:solid 2px #3399FF; margin-left:auto;
margin-right:auto;" > <%--#3399FF--%>
<asp:Image ID="imgPreview" runat="server" ImageUrl="~/Preview.aspx"
/>
</div>

any ideas?
 
I've soled it using
divPreview.Attributes["style"]

"Anton" <no_email> wrote in message



asp.net 3.5
I have this markup, The problem is that I want the border to go arround
the image. As the markup is now thediv fills entire space and the border
comes on the outside of that space..  I want the border to go arroundthe
image so I can show to the user how size of the image.
In the code I can get the pixels size of the image so I was wondering how
to set the div height & width programmatically?
I didn't see any height & width properites on the div
(I know I have to add a runat tag and an id in order to reference it from
servre code)
<div style="text-align:center; border:solid 2px #3399FF; margin-left:auto;
margin-right:auto;" >  <%--#3399FF--%>
       <asp:Image ID="imgPreview" runat="server" ImageUrl="~/Preview.aspx"
/>
</div>
any ideas?- Hide quoted text -

- Show quoted text -

I think you can also try to use CSS (padding and border attributes)
without using any "fixed" values from the code-behind
 
Back
Top