tags:

views:

38

answers:

3

How can i get same functionality in windows forms as in the next example. When i have two links one beneath, and when i click first link a panel is visibleunder it and next link is shifted. When i click again the panel is invisible and second link shifted back.

  <script type="text/javascript">
   function toggleDivState(divName)
   {
      var ctl = window.document.getElementById(divName);
      if (ctl.style.display == "none")
         ctl.style.display = "";
      else
         ctl.style.display = "none";
   }
  </script>

<a href="javascript:toggleDivState('poll<%# Eval("ID") %>');">
<div style="display: none;" id="poll<%# Eval("ID") %>">
A: 

Something like this? on click:

control1.Visible = !control1.Visible;
control2.Visible = !control1.Visible;

??

riffnl
This won't help. The second link should shift down.
Ismail
A: 

You can use panels that have the 'Dock' property said to 'Top' - you can then adjust the height of said panel to suit.

Rowland Shaw
if i set the Dock property of panel to 'Top' it docks to parent control , which is Form. And i want to see the panel under the link if i click the link
Mike
You could just have another panel docked above that, if needs be?
Rowland Shaw
A: 

Sound like you need a FlowLayoutPanel with FlowDirection = TopDown.

Put within this Panel your Link, Panel, Link2 and Panel2. Within the LinkClick event you set the Panel.Visible = !Panel.Visible.

Oliver