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
310
Conditionally Masking Cell Data
posted

Hello there,

We have a need to display personal information in redacted form.( ie SSN would display XXXXX1234, but we deal with other personal information and have worked out a component that will mask the data on simple controls.)

However, we use a lot of UltraWinGrid controls as well as UltraCombo controls with tabular displays. The data for these comes from DataSets and I don't really want to change the DataSet as some users will see full information and some will not. At the same time, if I redact the display, I don't want the ADO.NET GetChanges() method on the dataset to trigger something has changed so we need to stick to the display area on this.  Here is the code I would LIKE to write, but cells don't have setters, see the final line where I would like to assign a value to row.Cells[_columnIndex].

    public UltraGrid MaskedUltraGrid
    {
      get { return _grid; }
      set
      {
        _grid = value;
        if( MaskingEnable )
        {
          var masking = new Mask();
          UltraGridLayout layout = this._grid.DisplayLayout;
          UltraGridBand   band   = layout.Bands[_bandIndex];
          UltraGridColumn column = band.Columns[_columnIndex];
          foreachvar row in _grid.Rows )
          {
            ifConvert.ToInt32( row.Cells["Type_ID"] ) == 1 || 
Convert.ToInt32(row.Cells["Type_ID"]) == 8 )
              row.Cells[_columnIndex] = 
masker.MaskString( 
row.Cells[_columnIndex].ToString(), 
MaskingCharacter );
          }          
        }
      }

Does anyone have an alternative to using my masking control in a 
way that will permit it's use I prefer not to use the UltraGridMaskedEdit
since it can't conditionally set the mask as in the above if condition?

Thanks in advance if anyone can point me the right way,
Kent
Parents
No Data
Reply
  • 310
    Offline posted

    By the by...

              UltraGridLayout layout = this._grid.DisplayLayout;
              UltraGridBand   band   = layout.Bands[_bandIndex];
              UltraGridColumn column = band.Columns[_columnIndex];
    are a red herring... I was searching through the components looking for
    something useful but are not required in above code.
    Kent
Children