Click here to Skip to main content
15,917,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all, I am working in VS 2012 with vb.net. and asp.net 4.5. I am using a div to group some controls. When a condition is met I want to move the div and controls in div up the screen. I used: div1.Attributes.Add("style", "position:relative; left:0px;top:0px") in the code behind. In the aspx page I have: <div runat="server" style="border: thin solid #000000; background-color: #ECE4C5" id="div1" height="50px" align="center"> The controls move up, but the frame around the controls and the background color do not show. I hope I explained what I am trying to accomplish well enough so someone will understand. Any help would be greatly appreciated. This isn't homework. I have been out of school for ages.

Thank-you very much,

D-Bar
Posted
Comments
D-Bar 8-Aug-13 13:27pm    
Thank-you woopsydoozy. This line of code got the frame to appear, but it did not move up the screen and no background color, but it is a start.
D-Bar 8-Aug-13 14:06pm    
I tweaked the top position of each control and was able to get all the controls to move up, including the div, to the desired position. Now I just need the background color to appear.
D-Bar 8-Aug-13 15:30pm    
I added this extra line in my code behind and the background color appeared.
div1.Attributes("style") &= "background-color: #ECE4C5;"
If someone else is having this problem they will know how to correct it.

1 solution

Instead of adding a new style attribute, edit your existing one. Try:
VB
div1.Attributes("style") &= "position:relative;left:0px;top:0px;"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900