Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve height of datalist when height not initially set?

Status
Not open for further replies.

cawthor2

Programmer
May 2, 2002
10
0
0
US
I'm trying to dynamically adjust the height of a container div based on the height of a datalist it contains. However, I don't have a default height set for the datalist, the height just flexes based on how many rows are returned. I thought I could just do an body onload statement like this:

onload="document.getElementById('detail_div').style.height = document.getElementById('DataList1').height;"

but this doesn't return anything. If I explicitly set the height of the DataList, then it works fine. How can I find out the height of my DataList if I don't set it when its created?
 
Oops...sorry, you are correct. It's because I had absolute positioning on my datalist, it wasn't being contained within the div. Changed to relative and the div expands as expected.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top