Dynamic div height

J

Jensen bredal

Hello,
How can i dynamically change the height of my <div></div> element on my
webform.

I use C# and i want this height to be set according to screen resolution,
tipically in my code behind file. I have detected screen resolution .

I tried to embbed height:<%# computedheight %> in the style of the div
ellements but that does not seem to make sens.

Many thanks in advance

JB
 
G

Guest

Hi,

Have a runat=server attribute and an ID for your DIV tag to create a
HtmlGenericControl on the server side. Then you can easily set the width or
height of the DIV tag on the server-side itself.

In your code-behind:

MyDivTag.Attributes["style"] = "width:100px; height:200px;";

Hope this helps?
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top