Absolute Position of Control on Web Form
Is there a way of setting the absolute position of a control on a web Form?
In most samples, positioning is done with a table. I want to do it programmatically by setting the absolute position of a control added programmatically to the page.
Your help is very much appreciated
Beat
[689 byte] By [
beat] at [2008-2-19]
Hi,
Please take look at the code snippet below. Adding a TextBox dynamically and then settings its absolute positioning.
Code sample uses .NET 2.0 Beta 2
--
CODE SNIPPET
--
protected void Page_Load(object sender, EventArgs e)
{
TextBox objTextBox = new TextBox();
objTextBox.Text = "Sample";
//style="left: 100px; position: absolute;top: 100px"
objTextBox.Style.Add("position", "absolute");
objTextBox.Style.Add("left", "100");
objTextBox.Style.Add("top", "100");
Page.Form.Controls.Add(objTextBox);
}
--
Regards,
Vikram