Tuesday, May 16, 2017

Column merging as group in Infragistics Ultra Win Grid



Column merging as group in Infragistics Ultra Win Grid


If you want to merge columns as group like excel as shown in the below


 
Well Information
WellID
WellName
Address
1
well1
houston,tx
2
well2
dallas,Tx


 


 


 


 


 
Event
Vb.net code:
 Private Sub ugMain_InitializeLayout(sender As Object, e As InitializeLayoutEventArgs) Handles ugMain.InitializeLayout
        Dim wellGroup As UltraGridGroup = Nothing


        Dim readOnlyGroup As UltraGridGroup = Nothing


        ' Clear existing groups if any.


        e.Layout.Bands(0).Groups.Clear()




        ' Add two groups with two different keys. First arguement to the Add call is


        ' the key and the second arguement is the caption of the group.


        wellGroup = ugMain.DisplayLayout.Bands(0).Groups.Add("WellGroup", "Well Info")


        readOnlyGroup = ugMain.DisplayLayout.Bands(0).Groups.Add("ReadOnlyGroup", "Read Only")
 


        e.Layout.Bands(0).Columns("WellID").Group = wellGroup


        e.Layout.Bands(0).Columns("WelName").Group = wellGroup


        e.Layout.Bands(0).Columns("Address").Group = wellGroup




        e.Layout.Bands(0).Override.HeaderAppearance.TextHAlign = Infragistics.Win.HAlign.Center


        e.Layout.Bands(0).Override.HeaderAppearance.FontData.Bold = DefaultableBoolean.True




    End Sub


C#.net code:
Protected  void ugMain_InitializeLayout(object sender, InitializeLayoutEventArgs e)


{


       UltraGridGroup wellGroup = null;


       UltraGridGroup readOnlyGroup = null;


       // Clear existing groups if any.


       e.Layout.Bands(0).Groups.Clear();


 


       // Add two groups with two different keys. First arguement to the Add call is


       // the key and the second arguement is the caption of the group.


       wellGroup = ugMain.DisplayLayout.Bands(0).Groups.Add("WellGroup", "Well Info");


       readOnlyGroup = ugMain.DisplayLayout.Bands(0).Groups.Add("ReadOnlyGroup", "Read Only");


 


       e.Layout.Bands(0).Columns("WellID").Group = wellGroup;


       e.Layout.Bands(0).Columns("WelName").Group = wellGroup;


       e.Layout.Bands(0).Columns("Address").Group = wellGroup;


 


 


       e.Layout.Bands(0).Override.HeaderAppearance.TextHAlign = Infragistics.Win.HAlign.Center;


       e.Layout.Bands(0).Override.HeaderAppearance.FontData.Bold = DefaultableBoolean.True;


 


}


 

No comments:

Post a Comment