Panel and ASP.NET

  • Thread starter Thread starter Fabrizio
  • Start date Start date
F

Fabrizio

Hi,
There is any chance to insert a control like a text box
in a panel choosing the absolute position?
When I try to insert a label , the panel positions the
control on a locked position.
Thanks
Fabrizio
 
Hi Fabrizio,

The Panel web control is translated to a DIV tag, now you will need to set
the Label.Style accordly , I don't recall the exact property you have to
set, but most possible will be set the positioning to relative and set the
topX and topY

Hope this help,
 
I just toyed around with it a little. The only way I was able to set an
absolute positon for a textbox in a panel is to go to HTML view and add a
style attribute to the HTML text by hand. You can copy it from the panel
statement easily and modify. If you then return to design mode and try to
move the textbox by hand the manually added position values get dropped by
the IDE. So leave the controls alone once you set the position inside HTML.
You can accomplish what you wanted to do, but not at the efficiency you are
looking for. You will loose the ability to make corrections to the positions
in the design view. Though you are able to move the panel around and retain
the position of the textbox within the panel just fine which is good.

VS really has a limitation once you drop a control into a panel and you have
to either live with only a flow layout mode or manually change the HTML.
Also after you added a control and manually added a style attribute and set
the TOP/LEFT position, any future dragged/dropped controls into the panel
are added in flow layout style but with a gap since VS did not notice that
we manually the prior control manually away from its initial flow controlled
position.

Here's a quick example for a textbox that you dragged/dropped inside a
panel:

Change: <asp:TextBox id="TextBox1" runat="server">
To: <asp:TextBox id="TextBox1" style="LEFT: 50px; POSITION:
absolute; TOP: 50px" runat="server">

Then you play around with the LEFT/TOP values to adjust the position within
the panel. The absolute reference seems to apply to within the bounds of the
panel and not the position in the complete browser space btw.


Hope this helps

Robert Sentgerath
 
If you want to be able to move a control embedded in a panel, change the
flow mode in the panel attribute
ms_positioning="GridLayout". The panel will now contain a grid allowing
adjustment of controls embedded in it. Panels default to "FlowLayout". You
make this change from html inside the html page at the tag pointed to by
Panel. Similarly, you can change any control which supports this to either
flow or grid layout.
 
Back
Top