This is a migrated thread and some comments may be shown as answers.

Resize of data area after grouping

3 Answers 123 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tim Cousins
Top achievements
Rank 1
Tim Cousins asked on 03 Mar 2010, 12:01 PM
Unbound RadGridView with Datatable passed as data source

Columns programatically set (Best fit, Custom headers etc), grid height Auto sizes depending on number of rows passed in Datatable (built-in functionality - not set programatically).

Grid populates and operates exactly as expected, however after "grouping" by a particular column, the "data rows" element of the grid is not redrawn leading to a scroll-bar.

I'm pulling my hair out trying to resize the data area in the "GroupByChanging" event to show all rows (with Group headers) without the need for a scroll bar - your help would be greatly appreciated !!!

Apologies for what is probably a straight forward solution and my thanks in advance,

Tim.

3 Answers, 1 is accepted

Sort by
0
Tim Cousins
Top achievements
Rank 1
answered on 03 Mar 2010, 01:10 PM
Finally cracked it.  This may not be the best/neatest solution, or indeed work in all cases, however it may be of some benefit to others.

Private Sub RadGridView1_GroupByChanged(ByVal sender As ObjectByVal e As Telerik.WinControls.UI.GridViewCollectionChangedEventArgs) Handles RadGridView1.GroupByChanged  
'Resize the grid according to whether the group by clause is set  
Dim _gvi As UI.GridViewInfo = e.GridViewTemplate.Owner.MasterGridViewInfo  
If e.GridViewTemplate.GroupBy <> "" Then 
    e.GridViewTemplate.Owner.Height = _gvi.GridViewElement.ChildRowHeight + _gvi.TableHeaderRow.GetActualHeight(RadGridView1.GridElement)  
Else 
e.GridViewTemplate.Owner.Height = (_gvi.GridViewElement.DesiredSize.Height * _gvi.Rows.Length) + _gvi.TableHeaderRow.GetActualHeight(RadGridView1.GridElement)  
End If 
End Sub 
 
 
 

Great components though, well done Telerik team !
0
Jack
Telerik team
answered on 04 Mar 2010, 08:40 AM
Hi Tim Cousins,

I am glad to hear that you have found a solution that works for you and thank you for sharing it with the community. If you need more precise method to calculate the desired grid height, please take a look at this forum thread. I hope this helps.

Sincerely yours,
Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Tim Cousins
Top achievements
Rank 1
answered on 04 Mar 2010, 10:45 PM
Jack,

Thanks for the prompt reply.

I had indeed looked at the thread and was trying to adjust it to my needs.

Just wanted to say what a useful tool the forum is and I'm very impressed by the support levels from the Telerik team.

Well done.
Tim
Tags
GridView
Asked by
Tim Cousins
Top achievements
Rank 1
Answers by
Tim Cousins
Top achievements
Rank 1
Jack
Telerik team
Share this question
or