Change div sizes at runtime.

Hello,
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">
                   <ContentTemplate>
                       <asp:Image runat="server" ID="img"
                           ImageUrl=""
                           Height="900px" Width="640px" BorderStyle="Solid" BorderWidth="2px" BorderColor="Red"></asp:Image>
                   </ContentTemplate>
               </asp:UpdatePanel>
           </div>

           <div id="divResult" style="float: left;" runat="server">
               <asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="upnlTicks" ChildrenAsTriggers="False">
                   <ContentTemplate>
                       <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">
                               <ItemTemplate>
                                   <table class="nozoom" id="tblzoom" runat="server">
                                       <tr>
                                           <td>

Open in new window


I've tried

divImgContainer.Style.Add("height", "1200px");
Img.Style.Add("height", "1200px");
divResult.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???

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

document.getElementById("divImgContainer").setAttribute("style", "height: 1200px;");
0
 
Ryan ChongCommented:
can you provide generated HTML and the aspx source code?
0
 
Adrian CrossAuthor Commented:
Question edited.
0
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!
0
 
Ryan ChongCommented:
coool, then you may proceed to close this question cheers
0
 
Ryan ChongCommented:
as proposed
0
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.