473,231 Members | 1,755 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,231 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 4230
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: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.