/// <summary>
        /// This routine is called to let the application set default
        /// cell values for the given row.
        ///
        /// This routine will be called with 2 possible contexts -
        /// new row initialization and new row activation.
        ///
        /// New rows added by the user selecting a row and pressing the
        /// "ins" key, will result in this routine being called with a
        /// e.NewRowContext equal to NewRowContext.RowInit.
        ///
        /// When a new InsertRow (the row at the very bottom of the grid) is
        /// created, this routine will be called to permit the application to
        /// initialize it to a set of default values. The e.GridRow.IsInsertRow
        /// can be tested to see which if the InsertRow is the row being set.
        ///
        /// When the user activate the InsertRow, this routine will also be
        /// called to let the application set - or reset - the values again.
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SuperGridControl1RowSetDefaultValues(
            object sender, GridRowSetDefaultValuesEventArgs e)
        {
            // We only want to initialize new rows upon their creation,
            // not each time they are activated (only applicable to the InsertRow).

            if (e.NewRowContext == NewRowContext.RowInit)
            {
                GridRow row = e.GridRow;

                row.Cells[0].Value = GetMachineName();
                row.Cells[1].Value = false;
                row.Cells[2].Value = false;
                row.Cells[3].Value = DateTime.Now;

                row.Cells[4].Value   = "Start";
                row.Cells[4].Visible = false;
            }
        }
Exemple #2
0
 /// <summary>
 /// This event is sent when a new row is added.  It gives
 /// our application the opportunity to establish a new
 /// set of default values for the added row.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void SuperGridControl1RowSetDefaultValues(
     object sender, GridRowSetDefaultValuesEventArgs e)
 {
     if (e.GridRow.Cells.Count == 0)
     {
         e.GridRow.Cells.Add(new GridCell("John*"));
         e.GridRow.Cells.Add(new GridCell("Doe"));
         e.GridRow.Cells.Add(new GridCell(20));
         e.GridRow.Cells.Add(new GridCell(20001));
         e.GridRow.Cells.Add(new GridCell(DateTime.Now));
     }
     else
     {
         e.GridRow.Cells[0].Value = "John*";
         e.GridRow.Cells[1].Value = "Doe";
         e.GridRow.Cells[2].Value = 20;
         e.GridRow.Cells[3].Value = 20001;
         e.GridRow.Cells[4].Value = DateTime.Now;
     }
 }