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
225
Best way to hide a cell
posted

What is the best way to completely hide a single cell.. (or a selected group of cells)

on certain rows I have fields that will always be null and want to hide the cells completely.

 

Chears,

Dave

  • 2070
    Verified Answer
    posted

    Hi Dave,

     

    Cell has a Hidden property. If you set it true, it will display blank spot in the row. InitializeRow event is probably a good place where you can put code to set this property.

     

    Sandip 

  • 89
    posted

    I did that with a bunch of trailing checkboxes on partial empty rows:

    protected override void InitializeRow(object sender, InitializeRowEventArgs e)
    {
          
    if (e.Row.Cells[cb].Value == DBNull.Value)
               e.Row.Cells[cb
    ].Style = ColumnStyle.FormattedText;
    }

  • 2765
    posted

    Suppose you wants to shows only 2 columns and want to hide rest of columns. Then try this column

    Private Sub GrdMain_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles GrdMain.InitializeLayout

    Try

              For Each oColumn As Infragistics.Win.UltraWinGrid.UltraGridColumn In sender.DisplayLayout.Bands(0).Columns

                             Select Case oColumn.Key.ToUpper

                                       Case "Column Name 1"

                                                  oColumn.Header.Caption = "Modified Column Name 1"

                                        Case "Column Name 2"

                                                  oColumn.Header.Caption = "Modified Column Name 2"

                                       Case Else

                                                   oColumn.Hidden = True

                            End Select

                     Next

               Catch ex As Exception

               End Try

    End Sub