jlrolin
jlrolin

Reputation: 1614

jQuery height() problem

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?

Upvotes: 0

Views: 232

Answers (2)

tvanfosson
tvanfosson

Reputation: 532465

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.

Upvotes: 4

Jay Zeng
Jay Zeng

Reputation: 1421

try:

$('ctl00_MainContent_grdPersonResults').innerHeight();

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

Upvotes: 0

Related Questions