Question
How can i get the height of the row, i tried this code, which is called in the PreRender-Event of the asp-page:
foreach( GridNode gn in gantt.Gantt.Grid.GridStructure.RootNodes )
{
GanttRow gr = GanttRow.FromGridNode(gn);
nHeight -= gr.Rect().Y;
}
But gr.Rect().Y is always -50, regardless of the height of the row (gr.Rect().Height is always 0 by the way ?)
Answer
GanttRow.FromGridNode(gn).Rect().Height is the correct way to find out the height. It will however only be correct for currently visible rows. Rows not on screen have an undefined height since their text wrapping and other rules are not calculated.
To get the correct surroundings to calculate the total visible height you must know that :
#1 In Gantt_ASP the Gantt is rendered in memory (the correct values to the GanttRow rectangles are set after this).
#2 Then internal ViewState is applied (so that the correct paging is set, and nodes folded and collapsed according to user actions)
#3 Then the OnApplyViewState event is fired
Put your Gantt-Height-changing code in the OnApplyViewState event.
protected void Gantt_ASP1_OnApplyViewState(object sender, EventArgs e)
{
this.Gantt_ASP1.Height = 200;
}