Getting Top Left Poition of the control????

  • Thread starter Thread starter Samuel Rhodes
  • Start date Start date
S

Samuel Rhodes

Hi
I am trying to write a code snippet that would display a '?' sign on the top
left of a control.
I do not want to hard code the positioning of the DIV which will contain
that '?'.

Is it possible to somehow know the top, left position of the content
rendered by a User Control in a asp page.

For eg, assume the figure below as a web page and A and B as user controls
contained in that web page.
I want to write code that would display a '?' on the position X. without
hardcoding the top, left position.

-----------------------------------------
| |
| A |
|______________________________|
| X |
| |
| |
| B |
| |
| |
|______________________________|
Thanks.

-Sami
 
That is what I do not want to do.....

I do want to put '?' in the user control (UC1), however, I want UC1 to be
intelligent enough to determine the top, left of its parent user control
(PUC) and display its content to that particular position, instead of me
having to force it there by html layouting.

Eliyahu Goldin said:
You should make a server control that will be a placeholder for the sign
and
then just set it's value or visibility. The control could be a label, a
<span>, or something else. Make an html layout inside the div in such a
way
that the placeholder will be in the required position.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


Samuel Rhodes said:
Hi
I am trying to write a code snippet that would display a '?' sign on the top
left of a control.
I do not want to hard code the positioning of the DIV which will contain
that '?'.

Is it possible to somehow know the top, left position of the content
rendered by a User Control in a asp page.

For eg, assume the figure below as a web page and A and B as user controls
contained in that web page.
I want to write code that would display a '?' on the position X. without
hardcoding the top, left position.

-----------------------------------------
| |
| A |
|______________________________|
| X |
| |
| |
| B |
| |
| |
|______________________________|
Thanks.

-Sami
 
You should make a server control that will be a placeholder for the sign and
then just set it's value or visibility. The control could be a label, a
<span>, or something else. Make an html layout inside the div in such a way
that the placeholder will be in the required position.
 
Hi
I am trying to write a code snippet that would display a '?' sign on the top
left of a control.
I do not want to hard code the positioning of the DIV which will contain
that '?'.

Is it possible to somehow know the top, left position of the content
rendered by a User Control in a asp page.

For eg, assume the figure below as a web page and A and B as user controls
contained in that web page.
I want to write code that would display a '?' on the position X. without
hardcoding the top, left position.

-----------------------------------------
| |
| A |
|______________________________|
| X |
| |
| |
| B |
| |
| |
|______________________________|
Thanks.

-Sami

wewewewewewewewewewew
 
Looks like you just need to style UC1 with position:absolute;top:0;left:0.
This should place UC1 in the top left corner of its parent.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


Samuel Rhodes said:
That is what I do not want to do.....

I do want to put '?' in the user control (UC1), however, I want UC1 to be
intelligent enough to determine the top, left of its parent user control
(PUC) and display its content to that particular position, instead of me
having to force it there by html layouting.

Eliyahu Goldin said:
You should make a server control that will be a placeholder for the sign
and
then just set it's value or visibility. The control could be a label, a
<span>, or something else. Make an html layout inside the div in such a
way
that the placeholder will be in the required position.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


Samuel Rhodes said:
Hi
I am trying to write a code snippet that would display a '?' sign on
the
top
left of a control.
I do not want to hard code the positioning of the DIV which will contain
that '?'.

Is it possible to somehow know the top, left position of the content
rendered by a User Control in a asp page.

For eg, assume the figure below as a web page and A and B as user controls
contained in that web page.
I want to write code that would display a '?' on the position X. without
hardcoding the top, left position.

-----------------------------------------
| |
| A |
|______________________________|
| X |
| |
| |
| B |
| |
| |
|______________________________|
Thanks.

-Sami
 
Noooo :)

if i use this "position:absolute;top:0;left:0". it will calculate the top
and left according to page, not according to user control in the page. Is
there a way to calculate the top and left of the content area rendered by
the user control, programmatically..

Let me give some more background info. All the user controls derive from a
base user control.. I want to provide help feature in all the user controls.
So I want to write another user control (UCHelp) which I will put in the
base UC (making it composite). I want to UCHelp to manage the positioning of
the #?' icon by itself. i.e. it should position the '?' icon at top left of
all the derived user controls. For that I need to calculate the point on the
screen where derived user control starts on the page in terms of top, left.

I DO NOT want to hardcode the top, left as user controls are used at various
places in page. I am looking for a way to do it dynamically with asp.net
code.

The solution that I already have is to read the top, left property of the
top most container div in a user control by using javascript and positioning
my '?' icon accordingly. I am looking for an asp.net way of solving this
problem..


Eliyahu Goldin said:
Looks like you just need to style UC1 with position:absolute;top:0;left:0.
This should place UC1 in the top left corner of its parent.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


Samuel Rhodes said:
That is what I do not want to do.....

I do want to put '?' in the user control (UC1), however, I want UC1 to be
intelligent enough to determine the top, left of its parent user control
(PUC) and display its content to that particular position, instead of me
having to force it there by html layouting.

Eliyahu Goldin said:
You should make a server control that will be a placeholder for the
sign
and
then just set it's value or visibility. The control could be a label, a
<span>, or something else. Make an html layout inside the div in such a
way
that the placeholder will be in the required position.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


Hi
I am trying to write a code snippet that would display a '?' sign on the
top
left of a control.
I do not want to hard code the positioning of the DIV which will contain
that '?'.

Is it possible to somehow know the top, left position of the content
rendered by a User Control in a asp page.

For eg, assume the figure below as a web page and A and B as user
controls
contained in that web page.
I want to write code that would display a '?' on the position X. without
hardcoding the top, left position.

-----------------------------------------
| |
| A |
|______________________________|
| X |
| |
| |
| B |
| |
| |
|______________________________|
Thanks.

-Sami
 
If you already have a javascript solution, you don't need to look for
anything else. Javascript is pretty an asp.net way, the more of it (the
javascript) the better.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Samuel Rhodes said:
Noooo :)

if i use this "position:absolute;top:0;left:0". it will calculate the top
and left according to page, not according to user control in the page. Is
there a way to calculate the top and left of the content area rendered by
the user control, programmatically..

Let me give some more background info. All the user controls derive from a
base user control.. I want to provide help feature in all the user
controls. So I want to write another user control (UCHelp) which I will
put in the base UC (making it composite). I want to UCHelp to manage the
positioning of the #?' icon by itself. i.e. it should position the '?'
icon at top left of all the derived user controls. For that I need to
calculate the point on the screen where derived user control starts on the
page in terms of top, left.

I DO NOT want to hardcode the top, left as user controls are used at
various places in page. I am looking for a way to do it dynamically with
asp.net code.

The solution that I already have is to read the top, left property of the
top most container div in a user control by using javascript and
positioning my '?' icon accordingly. I am looking for an asp.net way of
solving this problem..


Eliyahu Goldin said:
Looks like you just need to style UC1 with
position:absolute;top:0;left:0.
This should place UC1 in the top left corner of its parent.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


Samuel Rhodes said:
That is what I do not want to do.....

I do want to put '?' in the user control (UC1), however, I want UC1 to
be
intelligent enough to determine the top, left of its parent user control
(PUC) and display its content to that particular position, instead of me
having to force it there by html layouting.

message You should make a server control that will be a placeholder for the
sign
and
then just set it's value or visibility. The control could be a label,
a
<span>, or something else. Make an html layout inside the div in such
a
way
that the placeholder will be in the required position.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


Hi
I am trying to write a code snippet that would display a '?' sign on the
top
left of a control.
I do not want to hard code the positioning of the DIV which will contain
that '?'.

Is it possible to somehow know the top, left position of the content
rendered by a User Control in a asp page.

For eg, assume the figure below as a web page and A and B as user
controls
contained in that web page.
I want to write code that would display a '?' on the position X. without
hardcoding the top, left position.

-----------------------------------------
| |
| A |
|______________________________|
| X |
| |
| |
| B |
| |
| |
|______________________________|
Thanks.

-Sami
 
use position:inherit for child controls.



Samuel Rhodes wrote:

Re: Getting Top Left Poition of the control????
13-Apr-07

Noooo :

if i use this "position:absolute;top:0;left:0". it will calculate the top
and left according to page, not according to user control in the page. Is
there a way to calculate the top and left of the content area rendered by
the user control, programmatically.

Let me give some more background info. All the user controls derive from a
base user control.. I want to provide help feature in all the user controls.
So I want to write another user control (UCHelp) which I will put in the
base UC (making it composite). I want to UCHelp to manage the positioning of
the #?' icon by itself. i.e. it should position the '?' icon at top left of
all the derived user controls. For that I need to calculate the point on the
screen where derived user control starts on the page in terms of top, left

I DO NOT want to hardcode the top, left as user controls are used at various
places in page. I am looking for a way to do it dynamically with asp.net
code

The solution that I already have is to read the top, left property of the
top most container div in a user control by using javascript and positioning
my '?' icon accordingly. I am looking for an asp.net way of solving this
problem.

message
Previous Posts In This Thread:

Getting Top Left Poition of the control????
H
I am trying to write a code snippet that would display a '?' sign on the top
left of a control
I do not want to hard code the positioning of the DIV which will contain
that '?'

Is it possible to somehow know the top, left position of the content
rendered by a User Control in a asp page

For eg, assume the figure below as a web page and A and B as user controls
contained in that web page
I want to write code that would display a '?' on the position X. without
hardcoding the top, left position

----------------------------------------
Thanks

-Sami

That is what I do not want to do.....I do want to put '?
That is what I do not want to do....

I do want to put '?' in the user control (UC1), however, I want UC1 to be
intelligent enough to determine the top, left of its parent user control
(PUC) and display its content to that particular position, instead of me
having to force it there by html layouting

message
You should make a server control that will be a placeholder for the sign
You should make a server control that will be a placeholder for the sign an
then just set it's value or visibility. The control could be a label,
<span>, or something else. Make an html layout inside the div in such a wa
that the placeholder will be in the required position

--
Eliyahu Goldin
Software Developer & Consultan
Microsoft MVP [ASP.NET
http://msmvps.com/blogs/egoldi

to
controls

Re: Getting Top Left Poition of the control????
wewewewewewewewewewew

Re: Getting Top Left Poition of the control????
Looks like you just need to style UC1 with position:absolute;top:0;left:0
This should place UC1 in the top left corner of its parent

--
Eliyahu Goldin
Software Developer & Consultan
Microsoft MVP [ASP.NET
http://msmvps.com/blogs/egoldi

th
contai
without

Re: Getting Top Left Poition of the control????
Noooo :

if i use this "position:absolute;top:0;left:0". it will calculate the top
and left according to page, not according to user control in the page. Is
there a way to calculate the top and left of the content area rendered by
the user control, programmatically..

Let me give some more background info. All the user controls derive from a
base user control.. I want to provide help feature in all the user controls.
So I want to write another user control (UCHelp) which I will put in the
base UC (making it composite). I want to UCHelp to manage the positioning of
the #?' icon by itself. i.e. it should position the '?' icon at top left of
all the derived user controls. For that I need to calculate the point on the
screen where derived user control starts on the page in terms of top, left.

I DO NOT want to hardcode the top, left as user controls are used at various
places in page. I am looking for a way to do it dynamically with asp.net
code.

The solution that I already have is to read the top, left property of the
top most container div in a user control by using javascript and positioning
my '?' icon accordingly. I am looking for an asp.net way of solving this
problem..


message
If you already have a javascript solution, you don't need to look for anything
If you already have a javascript solution, you don't need to look for
anything else. Javascript is pretty an asp.net way, the more of it (the
javascript) the better.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net




Submitted via EggHeadCafe - Software Developer Portal of Choice
SQL Server 2005, .NET CLR, RegEx, and User-Defined Functions
http://www.eggheadcafe.com/tutorial...279-77d69ac8abc1/sql-server-2005-net-clr.aspx
 
Back
Top