Hi Nick,
I think the problem you're meeting should be divided into two parts:
1. The design-time jobs for your control:
The "GridLayOut" setting is for VS.NET IDE use at design-time more than
page in runtime. When the page is set to "GridLayout", each control draged
from toolbox onto the webform will contains absolute postion attributes in
the "style" attribute. And when they're moved , the values will be
synchronized by IDE.
eg:
<cc1
ositionControl id="Control1" style="Z-INDEX: 101; LEFT: 264px;
POSITION: absolute; TOP: 112px" runat="server"...... >
This won't happen when using the "FlowLayout".
2. The runtime jobs for your control:
Though the VS.NET IDE will help manage these position attributes at
deign-time(using GridLayout). This dosn't means that our webcontrol will
also display as absolute postion on the web page at runtime. This is
because the web page is rendered as Html elements and displaying in
clientside browser, if you want to make your custom control also located on
page by absolute positino, you need to render the absolute postion
styles(css styls) when rendering the html content of your web control. For
example:
the TextBox control(with absolute position) will render as the following
html elements:
<input name="TextBox1" type="text" id="TextBox1"
style="height:40px;width:256px;Z-INDEX: 102; LEFT: 304px; POSITION:
absolute; TOP: 40px" />
Note that the "style" value is different from the "style" in aspx page, we
need to manually set these css attributes in our control's code. However,
ASP.NET design-time has provided us the ability to retrieve the design-time
position attributes' values by providing a custom ControlDesigner. Here is
a blog article which has mentioned how to get this value :
How to interact with Style["LEFT"] and Style["TOP"] of the WebControl
during design time
http://blog.joycode.com/felix/articles/39633.aspx?Pending=true
For other reference about applying styles for asp.net controls you can have
a look at the MSDN's webcontrol develpment section:
#Styles in Server Controls
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconstylesinservercont
rols.asp?frame=true
Hope helps. Thanks.
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)