Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
740
MergedCell issue when viewing Ultragrid Data
posted

Hi All,

I need to show the values in this grid as the attached pic1.jpg, But when I tried merged cell properties i get the following view as attached in pic2.jpg. As you can see in the pic1 the "Process" field, "Claim" text even though its repeating, it will be shown in the next "Edi Id" just as a reference.

This is my coding in the initaliaze layout.

 

        private void ultraGrid6_InitializeLayout(object sender, InitializeLayoutEventArgs e)

        {

            // MERGED CELL FUNCTIONALITY RELATED ULTRAGRID SETTINGS

            // ------------------------------------------------------------------------

            // Set the merged cell style to the OnlyWhenSorted.

           // e.Layout.Override.MergedCellStyle = MergedCellStyle.Always;

            e.Layout.Override.MergedCellContentArea = MergedCellContentArea.VirtualRect;

            e.Layout.Override.HeaderClickAction = HeaderClickAction.SortMulti;

            e.Layout.Override.MergedCellAppearance.BackColor = Color.LightYellow;

 

            // Enable group-by functionality.

            e.Layout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;

 

            // Show add-row.

            e.Layout.Override.AllowAddNew = AllowAddNew.TemplateOnBottom;

 

            // Set the scroll style to immediate so the rows get scrolled immediately

            // when the vertical scrollbar thumb is dragged.

            e.Layout.ScrollStyle = ScrollStyle.Immediate;

 

            // ScrollBounds of ScrollToFill will prevent the user from scrolling the

            // grid further down once the last row becomes fully visible.

            e.Layout.ScrollBounds = ScrollBounds.ScrollToFill;

 

            // Enable fixed headers functionality. This will freeze the row selectors.

            e.Layout.UseFixedHeaders = true;

 

            // Show add row.

         //   e.Layout.Override.AllowAddNew = AllowAddNew.TemplateOnBottom;

 

            e.Layout.Bands[0].Columns["edi_transaction_id"].Header.Caption = "Edi Id";

            e.Layout.Bands[0].Columns["edi_transaction_id"].Header.VisiblePosition = 0;

            e.Layout.Bands[0].Columns["edi_transaction_id"].MergedCellStyle = MergedCellStyle.Always;

            e.Layout.Bands[0].Columns["edi_transaction_id"].MergedCellContentArea = MergedCellContentArea.VirtualRect;

            e.Layout.Bands[0].Columns["edi_transaction_id"].MergedCellAppearance.BackColor = Color.LightYellow;

            e.Layout.Bands[0].Columns["edi_transaction_id"].MergedCellEvaluationType = MergedCellEvaluationType.MergeSameValue;

 

            e.Layout.Bands[0].Columns["trans_datetime"].Header.Caption = "Transaction Time";

            e.Layout.Bands[0].Columns["trans_datetime"].Header.VisiblePosition = 1;

            e.Layout.Bands[0].Columns["trans_datetime"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateTime;

            e.Layout.Bands[0].Columns["trans_datetime"].MergedCellStyle = MergedCellStyle.Always;

            e.Layout.Bands[0].Columns["trans_datetime"].MergedCellContentArea = MergedCellContentArea.VirtualRect;

            e.Layout.Bands[0].Columns["trans_datetime"].MergedCellAppearance.BackColor = Color.LightYellow;

            e.Layout.Bands[0].Columns["trans_datetime"].MergedCellEvaluationType = MergedCellEvaluationType.MergeSameValue;

 

 

            e.Layout.Bands[0].Columns["message_desc"].Header.Caption = "Transaction Message";

            e.Layout.Bands[0].Columns["message_desc"].Header.VisiblePosition = 2;

            e.Layout.Bands[0].Columns["message_desc"].MergedCellStyle = MergedCellStyle.Always;

            e.Layout.Bands[0].Columns["message_desc"].MergedCellContentArea = MergedCellContentArea.VirtualRect;

            e.Layout.Bands[0].Columns["message_desc"].MergedCellAppearance.BackColor = Color.LightYellow;

            e.Layout.Bands[0].Columns["message_desc"].MergedCellEvaluationType = MergedCellEvaluationType.MergeSameValue;

 

 

           e.Layout.Bands[0].Columns["process"].Header.Caption = "Process";

            e.Layout.Bands[0].Columns["process"].Header.VisiblePosition = 3;

            e.Layout.Bands[0].Columns["process"].MergedCellStyle = MergedCellStyle.Always;

            e.Layout.Bands[0].Columns["process"].MergedCellContentArea = MergedCellContentArea.VirtualRect;

            e.Layout.Bands[0].Columns["process"].MergedCellAppearance.BackColor = Color.LightYellow;

            e.Layout.Bands[0].Columns["process"].MergedCellEvaluationType = MergedCellEvaluationType.MergeSameValue;

 

            e.Layout.Bands[0].SortedColumns.Add(e.Layout.Bands[0].Columns["edi_transaction_id"], true);

}

 

Can anyone tell how to do as pic1? It's urgent!!! All I need to show the  repeating record at a new "Edi Id".

 

Thanks in Advance.

  • 469350
    Offline posted

    Hi,

    So you want the Process column to merge only when the Edi Id column is also merged?

    What you would have to do is use an IMergedCellEvaluator. So what you do is create a class which implements this interface and set the MergedCellEvaluator property on the Process column to an instance of that class.

    The IMergedCellEvaluator has a single method which passes in two cells and you return whether you want the cells to be merged or not. So in your case, you would compare the value of the actual cells in the Process column and then you would use cell.Row.Cells["Edi Id"].Value to get the value of the cells in the same row in the Edi Id column and make sure they are also the same.

  • 740
    posted

    Hi guys,

    sorry i'm adding the pic2 .jpg now as I thought both pics were attached earlier.

    Thanks