473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 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 4234
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ken Kast | last post by:
Here's my situation. I have a statically positioned table that has an image in a cell. I also have some layers, defined by absolute-positioned DIVs for some animation. Everything works until I...
8
by: Chris Sharman | last post by:
See the bottom of http://www.prestonbridge.pwp.blueyonder.co.uk/index2.htm (4th line of the club officers section). The mark-up's validated html 4 & css, but in ie5.0/Win2000 my surname...
4
by: boclair | last post by:
Is this a known problem with IE6? I have a provisional two column layout, the left menu column is positioned absolute. The contents column is positioned relative. The contents column has an...
4
by: Jay | last post by:
Hi, How can I capture mouse position on Image? I found number of script capturing mouse position of the page. But I could not find anything based on image. What I want to find out is X Y...
2
by: manmit.walia | last post by:
Hello Fellow Developers, I have a small problem that you might be able to help me with. The method that I am trying to create is the ability to export a GridView and a image to word or excel. I...
2
roula
by: roula | last post by:
Hi, I have this code of some divs, and I am trying to put a transparent image in div #transp to cover a certain area of the parent div #main (in order to make an image map of the background image...
19
by: ThatsIT.net.au | last post by:
I come from a classic asp background, but have started using ASP.NET about 12 months ago, but I'm still not sure about the pros and cons of using controls v HTML spat out from code as you would in...
1
by: anasrazvi | last post by:
Hello All, I am implementing autocomplete functionality for a textbox inside a gridview. For this I am using a Div control to place the data based on the prefix key entered inside textbox. As...
5
by: woodced | last post by:
This is driving me a bit crazy now. I've got a page with 3 columns. However the 3 columns are divided up into horizontal rows. In the central column of hte horizontal row the content can be of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.