Get and Set Location of Controls in Page

G

Guest

Hi,

I am buidling some controls dynamically in the .cs file, context menu. I am
wondering if there is any chance I could obtain the location of any controls
and set the location of another control to that location. i.e. just setting
and getting the location.

Concern:
1.When is the best time to get the location? After PageLoad?
CreateChildControls?
2.I am using Javascript to obtain the location by control.style.top etc but
it returns 0 value? Y is it so?
3.Do controls such as table cells within table row within table has
position? If there is, is it relative or absolute location.

Thks
Cheers
 
B

Bruce Barker

unless the controls have explicit absolute style postions (ie grid mode),
there is no time on the server code to do this.

in client script you can only get the position after render is done. in
client script you don't use the style to get the postion because it what was
set in html and is often empty. also the postion will be relative to its
parent position. see:

http://msdn.microsoft.com/library/default.asp


-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top