Pages

Apr 13, 2009

How to set the position of the Asp.Net control at runtime

The LEFT and TOP attributes in the following code sets the left and top positions of a control. You can call this code from any where in your code.

For example, if I have a table or calender control and want to change the position of the control dynamically, this is the code I need to add.

Calendar1.Attributes.Item("style") = "Z-INDEX: 176; LEFT: 334px; POSITION: absolute; TOP: 176px"

And in Asp.Net 3.5 it would be

Calendar1.Attributes.CssStyle.Value = "Z-INDEX: 176; LEFT: 334px; POSITION: absolute; TOP: 176px";


No comments: