How can i set div height dynamically

I having a  placeholder it contains an usercontrol. So our placeholder contents  and  size varies every time.  Our need is on a menu selection we wants to place a div over that placeholder. But the issue is we want that div in placeholder height and width. Is any solution for this issue?


Logics Lab
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

try this,

<div id="dynamicDiv" runat="server" style="border:solid 1px #dcdcdc"></div>

dynamicDiv.Style.Add("height", "height of placeholder")
Well if your normale css is fine then you just do the following:

#1, if the div is in the placeholder: give it height and width 100%.
#2, if the placeholder is in the div: do nothing.

#1, Depending how you want it the div can take the height and with of the parent container which would be an placeholder here.

#2, If the placeholder is inside the div then it will automatically extend the size of the div around it since that div has a height which by default extend.

With kind regrads,

Kevin Hendricks

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Specify NO height, only a width.   The DIV will expand to fill the content going into it, so your problem is solved because the content controls the height of the DIV.  If there is a containing DIV, leave the height of that unspecified too.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.