471,595 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,595 software developers and data experts.

HTML 101 Position image relative to GridView row

This seems like it should be simple and I am pretty sure I've done similar
things a hundred times before but I sure can't seem to get it right this time.

I have a GridView with a column of text boxes. If I want to position an
image over the GridView just below, for instance, the textbox in row 4 of the
GridView. I don't care that it covers the other textboxes. I am
successfully obtaining the textbox and the image objects in client-side
javascript using document.getElementById().

I can position the image just fine. I just can't seem to get the position
of the chosen textbox relative to the screen or client area of the browser.

textBox.offsetTop = 2 // this seems to be the position relative to the cell
in the table of the rendered GridView

textBox.clientTop = 2 // this seems to be the position relative to the cell
in the table of the rendered GridView

textBox.style.pixelTop = 0

textBox.style.top = // empty
--
Dale Preston
MCAD C#
MCSE, MCDBA
Oct 21 '06 #1
2 4128
I clicked "post" too quickly. I wish there was a Review button to see your
post before finally submitting it.

Anyway, what my original post left out is what it is I am looking for:

Can anyone help me with how to get the location of an item in a GridView
row, in my case the textbox, in relation to either the document or in
relation to the client area of the browser so that I can position my image in
relation to that textbox?

Thanks,

Dale
--
Dale Preston
MCAD C#
MCSE, MCDBA
"Dale" wrote:
This seems like it should be simple and I am pretty sure I've done similar
things a hundred times before but I sure can't seem to get it right this time.

I have a GridView with a column of text boxes. If I want to position an
image over the GridView just below, for instance, the textbox in row 4 of the
GridView. I don't care that it covers the other textboxes. I am
successfully obtaining the textbox and the image objects in client-side
javascript using document.getElementById().

I can position the image just fine. I just can't seem to get the position
of the chosen textbox relative to the screen or client area of the browser.

textBox.offsetTop = 2 // this seems to be the position relative to the cell
in the table of the rendered GridView

textBox.clientTop = 2 // this seems to be the position relative to the cell
in the table of the rendered GridView

textBox.style.pixelTop = 0

textBox.style.top = // empty
--
Dale Preston
MCAD C#
MCSE, MCDBA
Oct 21 '06 #2
I solved my own problem. The solution is to add a POSITION style value of
"relative" to the textbox. Then offsetTop and offsetLeft provide real values
relative to the client area.
--
Dale Preston
MCAD C#
MCSE, MCDBA
"Dale" wrote:
This seems like it should be simple and I am pretty sure I've done similar
things a hundred times before but I sure can't seem to get it right this time.

I have a GridView with a column of text boxes. If I want to position an
image over the GridView just below, for instance, the textbox in row 4 of the
GridView. I don't care that it covers the other textboxes. I am
successfully obtaining the textbox and the image objects in client-side
javascript using document.getElementById().

I can position the image just fine. I just can't seem to get the position
of the chosen textbox relative to the screen or client area of the browser.

textBox.offsetTop = 2 // this seems to be the position relative to the cell
in the table of the rendered GridView

textBox.clientTop = 2 // this seems to be the position relative to the cell
in the table of the rendered GridView

textBox.style.pixelTop = 0

textBox.style.top = // empty
--
Dale Preston
MCAD C#
MCSE, MCDBA
Oct 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Ken Kast | last post: by
8 posts views Thread by Chris Sharman | last post: by
4 posts views Thread by boclair | last post: by
4 posts views Thread by Jay | last post: by
roula
2 posts views Thread by roula | last post: by
19 posts views Thread by ThatsIT.net.au | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.