Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB7
Expertise: beginner
Feb 17, 2003

Dynamically moving a server control

Dynamically moving a server control instance on the page is very easy, thanks to the possibility to add any style attribute to the control. In this case, you can dynamically add the control's LEFT and TOP coordinates, and another attribute that says you want to use DHTML's absolute positioning. To try this, just add a button control on the form, and add the following code in the button's Click event:

Private Sub Button1_Click(...) Handles Button1.Click
    Button1.Style.Add("POSITION", "absolute")
    Button1.Style.Add("LEFT", "300px")
    Button1.Style.Add("TOP", "200px")
End Sub
Run the page and click the button. When the form is reloaded, after the postback, the button will be positioned in the new location.
Marco Bellinaso
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date