By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,948 Members | 1,573 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,948 IT Pros & Developers. It's quick & easy.

Getting Top Left Poition of the control????

P: n/a
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
Apr 13 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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" <sa********@4D.orgwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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


Apr 13 '07 #2

P: n/a
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" <RE**************************@mMvVpPsS.orgwrote in
message news:u4**************@TK2MSFTNGP03.phx.gbl...
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" <sa********@4D.orgwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>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



Apr 13 '07 #3

P: n/a
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" <sa********@4D.orgwrote in message
news:eD*************@TK2MSFTNGP04.phx.gbl...
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" <RE**************************@mMvVpPsS.orgwrote in
message news:u4**************@TK2MSFTNGP03.phx.gbl...
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" <sa********@4D.orgwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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



Apr 13 '07 #4

P: n/a
On Apr 13, 4:27 pm, "Samuel Rhodes" <sam.rho...@4D.orgwrote:
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

Apr 13 '07 #5

P: n/a
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" <RE**************************@mMvVpPsS.orgwrote in
message news:uu**************@TK2MSFTNGP05.phx.gbl...
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" <sa********@4D.orgwrote in message
news:eD*************@TK2MSFTNGP04.phx.gbl...
>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" <RE**************************@mMvVpPsS.orgwrote in
message news:u4**************@TK2MSFTNGP03.phx.gbl...
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" <sa********@4D.orgwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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




Apr 13 '07 #6

P: n/a
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" <sa********@4D.orgwrote in message
news:OS**************@TK2MSFTNGP04.phx.gbl...
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" <RE**************************@mMvVpPsS.orgwrote in
message news:uu**************@TK2MSFTNGP05.phx.gbl...
>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" <sa********@4D.orgwrote in message
news:eD*************@TK2MSFTNGP04.phx.gbl...
>>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" <RE**************************@mMvVpPsS.orgwrote in
message news:u4**************@TK2MSFTNGP03.phx.gbl...
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" <sa********@4D.orgwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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




Apr 15 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.