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

ColumnGroupsViewDefinition

3 Answers 327 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ISB-developer
Top achievements
Rank 2
ISB-developer asked on 22 Feb 2012, 10:36 AM
Hi all.
I have a WindowsForm Aplication with a RadGridView(RadGridView3) added into mainForm.
I have a class "Class1" with a shared function:

Imports

 

Telerik.WinControls.UI

 

Public

Class Class1

Public Shared Function gridul_3() As RadGridView

Dim cerinte0 As New GridViewCheckBoxColumn()

Dim cerinte1 As New GridViewCheckBoxColumn()

Dim cerinte20 As New GridViewCheckBoxColumn()

Dim cerinte3 As New GridViewCheckBoxColumn()

Dim cerinte4 As New GridViewCheckBoxColumn()

Dim _teme As New GridViewTextBoxColumn()

Dim aptitudini As New GridViewCommandColumn()

Dim nivel0 As New GridViewCheckBoxColumn()

Dim nivel_0 As New GridViewCheckBoxColumn()

Dim nivel1 As New GridViewCheckBoxColumn()

Dim nivel20 As New GridViewCheckBoxColumn()

Dim nivel3 As New GridViewCheckBoxColumn()

Dim nivel4 As New GridViewCheckBoxColumn()

Dim observatii As New GridViewTextBoxColumn()

Dim columnGroupsView As ColumnGroupsViewDefinition

mainForm.RadGridView3.Columns.Clear()

mainForm.RadGridView3.AutoSize =

False

mainForm.RadGridView3.BackColor = System.Drawing.

Color.White

mainForm.RadGridView3.Dock = System.Windows.Forms.DockStyle.Fill

mainForm.RadGridView3.ForeColor = System.Drawing.Color.Black

mainForm.RadGridView3.MasterTemplate.AllowAddNewRow = True  

mainForm.RadGridView3.MasterTemplate.AllowRowReorder =

False

mainForm.RadGridView3.MasterTemplate.AutoExpandGroups =

True

 mainForm.RadGridView3.AutoGenerateColumns = False

 mainForm.RadGridView3.AllowAddNewRow = True

 mainForm.RadGridView3.AllowEditRow = True

 mainForm.RadGridView3.AllowRowResize = False

'add columns name

cerinte0.FieldName = "Nu_stie"

cerinte0.HeaderText =

"0"

 cerinte0.Width = 28

 

cerinte0.IsAutoGenerated =

True

cerinte1.FieldName =

"Stie_cu_ajutor"

 cerinte1.HeaderText = "1"

 cerinte1.Width = 28

 

cerinte1.IsAutoGenerated =

True

 cerinte20.FieldName = "Stie_singur"

 cerinte20.HeaderText = "2"

 cerinte20.Width = 28

 

cerinte20.IsAutoGenerated =

True

 cerinte3.FieldName = "Invata_si_pe_altii"

cerinte3.HeaderText =

"3"

 cerinte3.Width = 28

 

cerinte3.IsAutoGenerated =

True

 

cerinte4.FieldName =

"Expert"

 cerinte4.HeaderText = "4"
cerinte4.Width = 28

 

cerinte4.IsAutoGenerated =

True

 

_teme.FieldName =

"Teme_parcurse"

 _teme.HeaderText = "Asteptari "

 _teme.Width = 260

 

_teme.IsAutoGenerated =

True

 

aptitudini.Name =

"cauta_aptitudini"

 

aptitudini.HeaderText =

"*"

 aptitudini.FieldName = "*"

 aptitudini.Width = 18

 

aptitudini.IsAutoGenerated =

True

 

nivel_0.FieldName =

"N_Nu_stie"

 nivel_0.HeaderText = "0"

 nivel_0.Width = 28

 

nivel_0.IsAutoGenerated =

True

 

nivel1.FieldName =

"N_Stie_cu_ajutor"

 nivel1.HeaderText = "1"

 nivel1.Width = 28

 

nivel1.IsAutoGenerated =

True

 

nivel20.FieldName =

"N_Stie_singur"

 nivel20.HeaderText = "2"

nivel20.Width = 28

nivel20.IsAutoGenerated =

True

 

nivel3.FieldName =

"N_Invata_si_pe_altii"

 nivel3.HeaderText = "3"

 nivel3.Width = 28

 

nivel3.IsAutoGenerated =

True

 

nivel4.FieldName =

"N_Expert"

 

nivel4.HeaderText =

"4"  

nivel4.Width = 28

nivel4.IsAutoGenerated =

True

observatii.FieldName =

"Observatii"

observatii.HeaderText =

"Observatii"

observatii.Width = 124

observatii.IsAutoGenerated =

True

'add column into grid

With mainForm.RadGridView3.MasterTemplate

 .Columns.Add(cerinte0)

.Columns.Add(cerinte1)

.Columns.Add(cerinte20)

.Columns.Add(cerinte3)

.Columns.Add(cerinte4)

.Columns.Add(_teme)

.Columns.Add(aptitudini)

.Columns.Add(nivel_0)

.Columns.Add(nivel1)

.Columns.Add(nivel20)

.Columns.Add(nivel3)

.Columns.Add(nivel4)

.Columns.Add(observatii)

End With

' define groups

columnGroupsView =

New ColumnGroupsViewDefinition()

 columnGroupsView.ColumnGroups.Add(New GridViewColumnGroup("Cerinte post si alte cerinte"))

 columnGroupsView.ColumnGroups.Add(New GridViewColumnGroup("Asteptarile superiorului de la" & vbCrLf & " comportamentul subalternului"))

 columnGroupsView.ColumnGroups.Add(New GridViewColumnGroup("A"))

columnGroupsView.ColumnGroups.Add(New GridViewColumnGroup("Nivel angajat"))

 columnGroupsView.ColumnGroups.Add(New GridViewColumnGroup("Specificare observatii"))

 'add the subgroup and the columns into the first group

columnGroupsView.ColumnGroups(0).Rows.Add(New GridViewColumnGroupRow())

 columnGroupsView.ColumnGroups(0).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("Nu_stie"))

columnGroupsView.ColumnGroups(0).Rows.Add(New GridViewColumnGroupRow())

columnGroupsView.ColumnGroups(0).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("Stie_cu_ajutor"))

 columnGroupsView.ColumnGroups(0).Rows.Add(New GridViewColumnGroupRow())  

columnGroupsView.ColumnGroups(0).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("Stie_singur"))  

columnGroupsView.ColumnGroups(0).Rows.Add(New GridViewColumnGroupRow())  

columnGroupsView.ColumnGroups(0).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("Invata_si_pe_altii"))  

columnGroupsView.ColumnGroups(0).Rows.Add(

New GridViewColumnGroupRow())

columnGroupsView.ColumnGroups(0).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("Expert"))

'add the subgroup and the columns into the second group

columnGroupsView.ColumnGroups(1).Rows.Add(

New GridViewColumnGroupRow())

columnGroupsView.ColumnGroups(1).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("Teme_parcurse"))

columnGroupsView.ColumnGroups(2).Rows.Add(New GridViewColumnGroupRow())  

columnGroupsView.ColumnGroups(2).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("cauta_aptitudini"))

columnGroupsView.ColumnGroups(3).Rows.Add(

New GridViewColumnGroupRow())  

columnGroupsView.ColumnGroups(3).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("N_Nu_stie"))

columnGroupsView.ColumnGroups(3).Rows.Add(New GridViewColumnGroupRow())

 columnGroupsView.ColumnGroups(3).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("N_Stie_cu_ajutor"))

 columnGroupsView.ColumnGroups(3).Rows.Add(New GridViewColumnGroupRow())

 columnGroupsView.ColumnGroups(3).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("N_Stie_singur"))

 columnGroupsView.ColumnGroups(3).Rows.Add(New GridViewColumnGroupRow())

 columnGroupsView.ColumnGroups(3).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("N_Invata_si_pe_altii"))

columnGroupsView.ColumnGroups(3).Rows.Add(New GridViewColumnGroupRow())

columnGroupsView.ColumnGroups(3).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("N_Expert"))

columnGroupsView.ColumnGroups(4).Rows.Add(

New GridViewColumnGroupRow())

columnGroupsView.ColumnGroups(4).Rows(0).Columns.Add(mainForm.RadGridView3.Columns("Observatii"))

group definition
mainForm.RadGridView3.ViewDefinition = columnGroupsView

Return mainForm.RadGridView3

End Function
End Class

This function returns me the  mainForm.RadGridView3.


In the Load method ai call the mentioned function and I obtain the Radgridview3 with custon header columns.

Private

Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Class1.gridul_3()

End Sub

 

My question is how can I meke an height adjustment for grid header because i can't see all the column header text? 
I need to give an increased height for  each ColumnGroups added.

Thanks!
 

3 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 24 Feb 2012, 03:35 PM
Hello,

Thank you for writing and for the provided code.

You can control the height of the column groups by using the RowSpan property of the
GridViewColumnGroup. In your code you can do the following modification to get the desired height:
columnGroupsView.ColumnGroups.Add(New GridViewColumnGroup("Cerinte post si alte cerinte"))
columnGroupsView.ColumnGroups(0).RowSpan = 40
This should be done for all column groups.

I hope you will find this useful. If you have further questions, I would be glad to help.
 
Greetings,
Ivan Petrov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Avinash
Top achievements
Rank 1
answered on 17 Apr 2012, 01:16 AM
Hi Evan Petrov,

I am having another issue with ColumnGroupsViewDefinintion.
I am using Winforms RadGridView 2010 Q3 control.
My problem is when i use ColumnGroupsViewDefinintion then I am not able to see Vertical Scrolling for the view.

Please let me know how can i set vertical scrolling with ColumnGroupsViewDefinintion.

thanks,
Avinash
0
Ivan Petrov
Telerik team
answered on 19 Apr 2012, 02:56 PM
Hello Avinash,

Thank you for writing back.

I tried to reproduce the issue using the version of the controls you have specified, but I was unable to do so. I would kindly ask you to send me your project or a sample where you reproduce the issue so I can investigate it further and provide you with adequate support. You should open a new support ticket in order  to be able to attach files. Please mention this thread in your ticket too.

Looking forward to your reply.
 
Regards,
Ivan Petrov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
ISB-developer
Top achievements
Rank 2
Answers by
Ivan Petrov
Telerik team
Avinash
Top achievements
Rank 1
Share this question
or