Implementing Show Hide of a Div

  • 12 years ago

    hi all,

    I am having two <Div> tags on my web page. I am using a CSS file for the appearance of these tags :










    width:24%;           /* remaining 1% is used as a gap between the two <Div> tags */



    What I want on my web page is to place a button, on whose click I want to hide "divholder2" and the width of "divholder1" should become 100%, so that I can make use of the whole width. And if I click the button again then it should show me "divholder2" along side "divholder1".




  • 12 years ago

    make your divs - 'Run as Server control'

    <div id="divholder1" runat="server" style="width: 616px; height: 272px">


    on your button click event set div visible property

    divholder1.visible = true

    divholder2.visible = false




Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“If debugging is the process of removing software bugs, then programming must be the process of putting them in.” - Edsger Dijkstra