Obtaining a ASP.NET Control's Location within the code behind class

B

Biff

Hello,

I am bringing up an iFrame with a calendar control in it in
coordination with a text box that holds a date field. In my code
behind class I add a method call to the text box's OnFocus event that
calls the javascript method that shows and positions the iFrame
(arguments are the text control, and the desired x and y coordinates of
the iFrame). Right now I use hardcoded fixed values for the calendar
location - it was expedient and it worked - but I would prefer to
dynamically locate the iFrame based on the location of the text box
that holds the date.

I could do this in my current scenario if I could obtain the x and y
coordinate of the text box within the code behind class (the page is
Flow Layout, not Grid Layout). I have not been able to figure out how
to obtain these coordinates.

Does anyone know a way of obtaining the x and y coordinates of a
ASP.NET text box from the code behind class?
Thanks,
Biff Gaut
Gaithersburg, MD
 
J

John Saunders

Biff said:
Hello,

I am bringing up an iFrame with a calendar control in it in
coordination with a text box that holds a date field. In my code
behind class I add a method call to the text box's OnFocus event that
calls the javascript method that shows and positions the iFrame
(arguments are the text control, and the desired x and y coordinates of
the iFrame). Right now I use hardcoded fixed values for the calendar
location - it was expedient and it worked - but I would prefer to
dynamically locate the iFrame based on the location of the text box
that holds the date.

I could do this in my current scenario if I could obtain the x and y
coordinate of the text box within the code behind class (the page is
Flow Layout, not Grid Layout). I have not been able to figure out how
to obtain these coordinates.

Does anyone know a way of obtaining the x and y coordinates of a
ASP.NET text box from the code behind class?

Server-side controls do not have x and y coordinates.

John Saunders
 
E

Eliyahu Goldin

Biff,

You should pass the coordinates from client to server. The most common way
of passing information that way is using hidden <input> elements.

Eliyahu
 

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,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top