ReportViewer control (v10) and height-Collection of common programming errors
Just as an update, Yes the ReportViewer version 10, still has the issue with the Height being all screwed up if there are other controls on the page. In case anyone else has this issue, here are my scripts to get the height of the control to work and resize correctly: rv1 is my report viewer control and fl is our custom parameter panel for the report parameters.
Sys.Application.add_load(function() { $find('rv1').add_propertyChanged(viewerPropertyChanged); });
$(window).resize(resize);
function viewerPropertyChanged(sender, e) {
if (e.get_propertyName() === 'isLoading') {
var viewer = $find('rv1');
if (!viewer.get_isLoading())
resizeWithOffset();
}
}
function resizeWithOffset() {
resize(11);
}
function resize(offset) {
if (typeof (offset) == 'object' || offset == 'undefined')
offset = 0;
// only apply if filter parameter panel is present
var parameterHeight = $('#fl').height();
if (parameterHeight != null) {
// get height of the report viewer toolbar
var toolbarHeight = $('#rv1_fixedTable > tbody > tr:nth-child(4)').height();
// get height of the padding between actual report content and toolbar
var paddingHeight = $('#rv1_fixedTable').height() - ($('#rv1_fixedTable > tbody > tr:nth-child(5) > td:nth-child(3)').height() + toolbarHeight);
// set new height.
var newHeight = ($(window).height() - (parameterHeight + toolbarHeight + 11)) + offset;
$('#rv1_fixedTable > tbody > tr:nth-child(5) > td:nth-child(3)').height(newHeight);
$('#rv1_fixedTable > tbody > tr:nth-child(5) > td:nth-child(3) > div').height(newHeight);
}
}