Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to set the div Height & Width from within C#

Reply
Thread Tools

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

 
 
Anton
Guest
Posts: n/a
 
      08-23-2009
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?


 
Reply With Quote
 
 
 
 
Anton
Guest
Posts: n/a
 
      08-23-2009
I've soled it using
divPreview.Attributes["style"]

"Anton" <no_email> wrote in message
news:eOh$(E-Mail Removed)...
> 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?
>



 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-26-2009
On Aug 23, 11:38*am, "Anton" <no_email> wrote:
> I've soled it using
> divPreview.Attributes["style"]
>
> "Anton" <no_email> wrote in message
>
> news:eOh$(E-Mail Removed)...
>
>
>
> > 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?- 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Why can't I change height with <col width="50" height="100">? Bernd Meier HTML 6 01-14-2008 07:25 AM
set div width to remaining width of the browser Steve Richter ASP .Net 2 06-15-2007 06:40 PM
Change height of DIV when div border set marco_giuliani_it@hotmail.com Javascript 0 09-21-2005 02:42 PM
How to tell height of div where height is not set? Don Vaillancourt Javascript 8 01-31-2005 11:32 AM



Advertisments