reposition control at runtime (problems)

L

Lee

Hello,

I am trying to reposition a calendar control at runtime i.e next to the
approriate button which was clicked.

Without the code below, the control appears in the same position but on top
of all other controls.
With the code, the calendar control is repositioned but it then appears
underneath all other controls.

calStartDate.Attributes["style"] = "position: absolute; top:400; left:
600;";

Adding 'z-index: 99;' to the above statement doesn't seem to have any
effect.

Thanks
Lee
 
G

Guest

Create new DIV and put you control withing it
It that case using DIV won't change you control layout when you set visible
for the control

Lee said:
Hello,

I am trying to reposition a calendar control at runtime i.e next to the
approriate button which was clicked.

Without the code below, the control appears in the same position but on top
of all other controls.
With the code, the calendar control is repositioned but it then appears
underneath all other controls.

calStartDate.Attributes["style"] = "position: absolute; top:400; left:
600;";

Adding 'z-index: 99;' to the above statement doesn't seem to have any
effect.

Thanks
Lee

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

This may be cause you have some non-window controls around, I know that
there are some cirscunstances where you get this problem. Do a google search
about that.

Also a word of advise, positioning the control to the precise coordinates
the way you are doing it can get you in trouble down the line, if the
browser window is resized you may not want the control at those exact
coordinates.

You better calculate the correct coordinates at runtime
 
L

Lee

I tried the adding the div around the calendar, within the form, but it had
no effect. I tried it outside the form and not surprising got a runtime
error. Did I interpret your comment correctly?? See below:

<form id="Form1" method="post" runat="server">
<div>
<asp:calendar id="calStartDate" style="Z-INDEX: 160; LEFT: 624px;
POSITION: absolute; TOP: 256px" runat="server" Width="224px" Height="168px"
Visible="False">
<SelectorStyle BackColor="White"></SelectorStyle>
</asp:calendar>
</div>
Remainder of the form controls.....





Michael Nemtsev said:
Create new DIV and put you control withing it
It that case using DIV won't change you control layout when you set
visible
for the control

Lee said:
Hello,

I am trying to reposition a calendar control at runtime i.e next to the
approriate button which was clicked.

Without the code below, the control appears in the same position but on
top
of all other controls.
With the code, the calendar control is repositioned but it then appears
underneath all other controls.

calStartDate.Attributes["style"] = "position: absolute; top:400; left:
600;";

Adding 'z-index: 99;' to the above statement doesn't seem to have any
effect.

Thanks
Lee

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not
cease to be insipid." (c) Friedrich Nietzsche
 

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

Top