Change the location of a panel dynamically

M

Mad Matt

Thank you all in advance for any advice you can give,

I am new to asp.net and am working with visual studio using Visual
Basic and not C#. I am very familiar with regular asp and vbscript.

My question is as follows: I have a form with multiple panels that need
to be displayed when checkboxes are checked. My problem is that I need the
panels location to be set dynamically during run time when the check box is
checked. I have five check boxes and 1 or all can be checked. If one is
checked I want the location of the panel to be at the top middle of the page.
If more than one is checked I want the first one to display at top middle and
each successive panel directly below that one.

How do I accomplish? I have played with multiple different properties such
as .cssStyle to no avail. Again, I am very new to dot net and am sure this is
fairly easy to do but cannot figure it out.

Any Help would be greatly appreciated.

Thank You.
 
H

haile

In cases where I have had to force the position of a panel, I have used
another panel that contains nothing but breaks, and I have used code-behind
to determine whether the second panel appears:

<asp:panel pnlSpacer ... >
<!-- lots of breaks -->
<br><br>
</asp:panel>
<asp:panel pnlOne>...</asp:panel>
<asp:panel pnlTwo>...</asp:panel>
<asp:panel pnlThree>...</asp:panel>
<asp:panel pnlFour>...</asp:panel>

And then in code-behind:

if (pnlTwo.Visible&&pnlThree.Visible&&pnlFour.Visible) pnlSpacer.Visible =
false;
else pnlSpacer.Visible = true;



haile
 
M

Mad Matt

Hiale,

Thank you for your response. This is originally what I did. However, if
I had all boxes check things looked great. If I three or two there were
spaces in between and it is a very complex form in which I could not waste
time.

I did however find the correct property eventually to alleviate my
problem. Depending on which boxes were checked I set the panel location
dynamically using the following code.

me.panelName.cssStyle.add("left", "200")
me.panelName.cssStyle.add("top", "400")

Was not able to set both attributes with one line, needed to set the
top and left seperate from each other. I'm sure if I played with it more it
could be done on one line.

Thank you again for your response and I have one more quick question.
How do I indicate that this thread has answered correctly or that I have
found the correct answer?

-Merry Christmas or Hanukah or Winter Celebration or whatever else is PC.
 
H

haile

Your use of CSS works in some browsers, but it is not portable. If you can
control the user environment, it works fine.

haile
 
M

Mad Matt

Haile,

Yes, we will be controlling the environment. It will be running inside of a
Windows domain with IIS and utilized through Internet Explorer. Since this
works in our office on IE I am assuming we should be OK to do this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,315
Messages
2,571,636
Members
48,458
Latest member
WernerAble

Latest Threads

Top