Change div sizes at runtime.

I'm trying to change the height and width of some divs, at runtime, but I haven't had much luck so far.

this my source code

 <div id="divImgContainer" style="height: auto; width: 1000px; overflow-y: scroll; display: inline" runat="server">

           <div id="divImg" style="height: 900px; width: 640px; overflow: auto; float: left;" runat="server">

               <asp:UpdatePanel runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional" ID="upnlMainImage">
                       <asp:Image runat="server" ID="img"
                           Height="900px" Width="640px" BorderStyle="Solid" BorderWidth="2px" BorderColor="Red"></asp:Image>

           <div id="divResult" style="float: left;" runat="server">
               <asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="upnlTicks" ChildrenAsTriggers="False">
                       <asp:Panel ID="pnlResult" runat="server" Height="900px" GroupingText="Mark Here" Width="320px">
                           <asp:Label ID="lblResults" runat="server" Text=""></asp:Label>
                           <asp:Repeater ID="rptResults" runat="server" OnItemCommand="rptResults_ItemCommand" OnItemDataBound="rptResults_ItemDataBound">
                                   <table class="nozoom" id="tblzoom" runat="server">

Open in new window

I've tried

divImgContainer.Style.Add("height", "1200px");
Img.Style.Add("height", "1200px");

and using attributes

divImgContainer.Attributes.Add("style", "height: 1200px;");

Open in new window

The code above won't change anything. I'm wondering if it is an updatepanel issue???

Adrian CrossAsked:
Who is Participating?
Ryan ChongCommented:
try something like this instead:

document.getElementById("divImgContainer").setAttribute("style", "height: 1200px;");
Ryan ChongCommented:
can you provide generated HTML and the aspx source code?
Adrian CrossAuthor Commented:
Question edited.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Adrian CrossAuthor Commented:
Thanks, that did the trick!
Ryan ChongCommented:
coool, then you may proceed to close this question cheers
Ryan ChongCommented:
as proposed
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.