public static void UpdateGrid(DataView itemTable,
            QuickGrid grid,
            DataGridClientInterface face,bool isKg,
            IsNewAllowed allowNew,
            IsReadOnly readOnly,
            params string[] fieldNames)
        {
            fieldNames = (string[])fieldNames.Clone();
            FieldProperties[] properties = GetProperties(ref fieldNames,isKg);
            int numberOfFields = fieldNames.Length;
            DataTable table = new DataTable();
            for (int i = 0;i<numberOfFields;i++)
            {
                System.Type type = properties[i].type;
                table.Columns.Add(fieldNames[i],type);
            }

            HelperFunctions.DataGridClientBridge bridge = null;
            if (face != null)
                bridge = new DataGridClientBridge(face);

            foreach (DataRowView rowView in itemTable)
            {
                DataRow row = rowView.Row;
                if (!DataInterface.IsRowAlive(row))
                    continue;
                DataRow newRow = table.NewRow();
                for (int i = 0;i<numberOfFields;i++)
                {
                    string fieldName = fieldNames[i];
                    if (!row.IsNull(fieldName) && row[fieldName].GetType() ==
                        typeof(System.DateTime))
                    {
                        DateTime d = (DateTime)row[fieldName];
                        newRow[fieldName] = d.ToShortDateString();
                    }
                    else
                        newRow[fieldName] = row[fieldName];
                }
                table.Rows.Add(newRow);
            }
            table.AcceptChanges();
            grid.ClearAllHandlers();
            ArrayList listOfColumnProperties = new ArrayList();
            for (int i=0;i<properties.Length;i++)
            {
                FieldProperties props = properties[i];
                if (props.isKeyField == true)
                    continue;
                if (IsReadOnly.Yes == readOnly)
                    props.readOnly = true;
                QuickGrid.ColumnProperties coll = new QuickGrid.ColumnProperties();
                switch (props.columnStyle)
                {
                    case ColumnStyle.Text:
                        coll.formatString = props.formatString;
                        break;
                    case ColumnStyle.Date:
                        coll.formatString = "d";
                        grid.AddButtonHandler(i,".",new EventHandler(OnDateClick));
                        break;
                    case ColumnStyle.Item:
                    {
                        if (!props.readOnly)
                        {
                            // since we are not allowing the user
                            // to actually edit the field
                            props.readOnly = true;

                            if (face == null)
                                throw new Exception("Oops, you need a handler for the item clicker");
                            grid.AddButtonHandler(i,".",new EventHandler(bridge.OnItemClick));
                        }
                        break;
                    }
                    default:
                        throw new Exception("Ahh no case statement");
                }
                if (props.columnHeading == "Description")
                {
                    coll.multiline = true;
                    coll.variable = true;
                }
                if (props.columnHeading == "Comments")
                {
                    coll.multiline = true;
                }
                coll.comboBoxValues = props.comboBoxItems;
                coll.heading = props.columnHeading;
                coll.size = props.width;
                coll.alignment = props.alignment;
                coll.readOnly = props.readOnly;
                listOfColumnProperties.Add(coll);
            }
            table.ColumnChanged +=new DataColumnChangeEventHandler(DataGridColumnChanged);
            if (bridge != null)
                table.ColumnChanged +=new DataColumnChangeEventHandler(bridge.DataGridColumnChanged);
            QuickGrid.ColumnProperties[] columnProperties = (QuickGrid.ColumnProperties[])listOfColumnProperties.ToArray
                                                (typeof(QuickGrid.ColumnProperties));
            grid.Setup(table,columnProperties,allowNew==IsNewAllowed.Yes?true:false);
        }
 public DataGridClientBridge(DataGridClientInterface face)
 {
     m_interface = face;
     m_fieldNames = face.DecimalFieldsToBeMonitored();
 }