views:

1441

answers:

1

Hi,

I have a number of GridView controls that I need to position side-by-side on a page. For example a GridView containing a list of items in a shopping basket, and a number of GridViews to the side showing pricing from a number of suppliers.

The columns are fixed width in the first GridView - meaning that the row height is variable depending on the amount of text.

So, the question is this - is there any way to discover the individual row heights of the first data-bound GridView such that I can alter the other GridViews to correctly align?

The Row.Height property of the grid after databinding is empty as the height has not been explicity set.

thanks!

+1  A: 

I don't know of any way to do this in .Net, you can use javascript, maybe set a .Net hidden field on load if you need it in code behind :

var h = document.getElementsByTagName('td')[0].offsetHeight;

Keep in mind this height will also include any cell padding or spacing you have set. Also, this assumes you're not explicitly setting the height in CSS which based on your question I assume you are not.

brendan
+1 The only way to do this is via JS
Rex M