Blog Home  Home Feed your aggregator (RSS 2.0)  
artiso Blog - Infragistics Grid für Aus- und Eingabe von Prozentwerten konfigurieren
Neues rund um's Thema .Net
 
 Monday, October 09, 2006

Folgender Code zeigt, wie man in eine Zelle im Infragistics-Grid Prozentwerte aus- und eingeben kann. Zu beachten ist hierbei, dass beim BeforeExitEditMode auf die Text-Eigenschaft zugegriffen werden muss, da der Value zu diesem Zeitpunkt noch nicht gesetzt ist.

private void ugShiftDetails_BeforeEnterEditMode(object sender, CancelEventArgs e)
{
   if (this.ugShiftDetails.ActiveCell.Column.Key == "PercentColumn")
   {
      UltraGridCell c = this.ugShiftDetails.ActiveCell;
      c.Value = ((double)c.Value) * 100;
   }
}

private void ugShiftDetails_BeforeExitEditMode(object sender, Infragistics.Win.UltraWinGrid.BeforeExitEditModeEventArgs e)
{
   if (this.ugShiftDetails.ActiveCell.Column.Key == "PercentColumn")
   {
      UltraGridCell c = this.ugShiftDetails.ActiveCell;
      try
      {
         c.Value = Double.Parse(c.Text) / 100;
      }
      catch
      {
         MessageBox.Show("Invalid Input");
      }
   }
}

Monday, October 09, 2006 3:39:22 PM (Mitteleuropäische Zeit, UTC+01:00)  #    Comments [0]    | 
Copyright © 2008 Thomas. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: