Monday, November 22, 2004

ASP.NET: Positioning dynamic created controls

As shown in previous blog entry's it is pretty easy to create controls in runtime using ASP.NET.
Positioning this controls can be done using the Style property. In fact you can set your css style properties for the control.

This example shows how to create an image control in runtime and position it absolute at a given position.

MyImage := Image.Create;
MyImage.ImageUrl := 'images/test.gif';
MyImage.ID := 'myimage';
MyImage.Style['Position'] := 'Absolute';
MyImage.Style['Top'] := '400px';
MyImage.Style['Left'] := '100px';

No comments: