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

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?
 
G

Guest

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 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?- 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top