tags:

views:

38

answers:

2

How do we go about accessing a height for a Gridview? The Gridview has a CSS attribute called height that is set to 800px, but I haven't been able to access anything with height()

$('ctl00_MainContent_grdPersonResults').height() = null

Any ideas?

A: 

try:

$('ctl00_MainContent_grdPersonResults').innerHeight();

innHeight(): http://docs.jquery.com/CSS/innerHeight

Jay Zeng
+4  A: 

When you want to get an element by id you need to prepend a pound sign/hash to use the id selector.

$('#ctl00_MainContent_grdPersonResults').height()...

without it, it will be selecting based on elements having the string as a class name. I'm sure that none of your controls would have that as a class name so the selector is failing. Note that because of the ASP.NET mangles names, though, it may be easier to assign a class name and use the class name selector.

tvanfosson
+1: I can't remember how many times I've done this same thing.
R. Bemrose
+1 arr, I also forgot that when pasting @jlrolin's code. Good catch
Jay Zeng
+1 Ive done it as well... more than id like to admit - in fact i didnt even catch it in his question.
prodigitalson