private void CreateDataGridHeader()
        {
            grdDetails.BorderStyle = BorderStyle.FixedSingle;

            grdDetails.Columns.Add("DoRevaluation", "...",
                                   typeof(bool));
            grdDetails.Columns.Add("AccountCode", "Account",
                                   typeof(string));
            grdDetails.Columns.Add("Currency", "[CUR]",
                                   typeof(string));
            grdDetails.Columns.Add("ExchangeRate", Catalog.GetString("Rate"),
                                   typeof(String));
            grdDetails.Columns.Add("Effective", Catalog.GetString("Effective"),
                                   typeof(string));
            grdDetails.Columns.Add("Status", Catalog.GetString("Status"),
                                   typeof(string));
            SourceGrid.DataGridColumn gridColumn =
                grdDetails.Columns.Add(null, "", new SourceGrid.Cells.Button("..."));
            FlinkController.InitFrmData(this, FperiodStart, FperiodEnd);
            gridColumn.DataCell.AddController(FlinkController);

            grdDetails.SelectionMode = SourceGrid.GridSelectionMode.Row;
            grdDetails.CancelEditingWithEscapeKey = false;

            // Set up for auto-sizing
            grdDetails.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.None;
            grdDetails.Columns[6].AutoSizeMode = SourceGrid.AutoSizeMode.None;

            for (int i = 1; i < 6; i++)
            {
                grdDetails.Columns[i].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch;
            }
        }
        /// <summary>
        /// Browse: (Re)LoadTableContents, called after injection of parameters or manual via button
        /// </summary>
        public void Search()
        {
            TVerificationResultCollection AMessages;
            Hashtable requestParams = new Hashtable();

            FDonorKey     = Convert.ToInt64(txtDonor.Text);
            FRecipientKey = Convert.ToInt64(txtRecipient.Text);

            string motivationGroup  = cmbMotivationGroup.cmbCombobox.Text;
            string motivationDetail = cmbMotivationDetail.cmbCombobox.Text;

            if (motivationGroup == ALL)
            {
                motivationGroup = "";
            }

            if (motivationDetail == ALL)
            {
                motivationDetail = "";
            }

            FDateFrom = dtpDateFrom.Date.HasValue ? dtpDateFrom.Date.Value.ToShortDateString() : String.Empty;
            FDateTo   = dtpDateTo.Date.HasValue ? dtpDateTo.Date.Value.ToShortDateString() : String.Empty;

            if ((FDonorKey == 0) && (FRecipientKey == 0))
            {
                MessageBox.Show(Catalog.GetString("You must restrict the search to a donor and/or a recipient."),
                                Catalog.GetString("Donor/Recipient Error"));
                txtDonor.Focus();
                return;
            }

            if (FLedgerNumber < 0)
            {
                MessageBox.Show(Catalog.GetString("Select Ledger and then press 'Search'."), Catalog.GetString("Ledger Error"));
                return;
            }

            if ((FDateFrom.Length == 0) && (dtpDateFrom.Text.Length > 0))
            {
                MessageBox.Show(Catalog.GetString("Please enter a valid Date From."), Catalog.GetString("Date From Error"));
                dtpDateFrom.Focus();
                dtpDateFrom.SelectAll();
                return;
            }

            if ((FDateTo.Length == 0) && (dtpDateTo.Text.Length > 0))
            {
                MessageBox.Show(Catalog.GetString("Please enter a valid Date To."), Catalog.GetString("Date To Error"));
                dtpDateTo.Focus();
                dtpDateTo.SelectAll();
                return;
            }

            requestParams.Add("TempTable", TEMP_TABLE_NAME);
            requestParams.Add("Ledger", FLedgerNumber);
            requestParams.Add("Donor", FDonorKey);
            requestParams.Add("Recipient", FRecipientKey);
            requestParams.Add("MotivationGroup", motivationGroup);
            requestParams.Add("MotivationDetail", motivationDetail);
            requestParams.Add("DateFrom", FDateFrom);
            requestParams.Add("DateTo", FDateTo);

            try
            {
                Cursor = Cursors.WaitCursor;
                GiftBatchTDS newTDS = TRemote.MFinance.Gift.WebConnectors.LoadDonorRecipientHistory(
                    requestParams,
                    out AMessages);

                if ((AMessages != null) && (AMessages.Count > 0))
                {
                    MessageBox.Show(Messages.BuildMessageFromVerificationResult(Catalog.GetString("Error calling Donor/Recipient history"), AMessages));
                    return;
                }

                FMainDS = newTDS;

                if (grdDetails.Columns.Count < 1)
                {
                    // First time through here
                    SetupGrid();

                    DataView myDataView = FMainDS.Tables[TEMP_TABLE_NAME].DefaultView;
                    myDataView.AllowNew   = false;
                    grdDetails.DataSource = new DevAge.ComponentModel.BoundDataView(myDataView);

                    // Display header tooltips
                    for (int i = 0; i < grdDetails.Columns.Count; i++)
                    {
                        SourceGrid.DataGridColumn     c = grdDetails.Columns[i];
                        SourceGrid.Cells.ColumnHeader h = (SourceGrid.Cells.ColumnHeader)c.HeaderCell;
                        grdDetails.SetHeaderTooltip(i, h.DisplayText);
                    }

                    // First time we have to size grid ourselves
                    grdDetails.AutoResizeGrid();

                    // Subsequent changes to the data source will automatically sresize the grid columns to the new data
                    grdDetails.DataSource.ListChanged += DataSource_ListChanged;
                }
                else
                {
                    DataView myDataView = FMainDS.Tables[TEMP_TABLE_NAME].DefaultView;
                    myDataView.AllowNew   = false;
                    grdDetails.DataSource = new DevAge.ComponentModel.BoundDataView(myDataView);
                }

                btnView.Enabled = grdDetails.Rows.Count > 1;

                // update controls based on results
                OnCmbMotivationChange(this, null);
                UpdateTotals();
                UpdateRecordNumberDisplay();
                SetupMotivationComboboxes();

                if (FMainDS != null)
                {
                    // select the first row in the grid
                    SelectDetailRowByDataTableIndex(1);
                    this.ActiveControl = grdDetails;
                }

                // Enabled or disable Gift Statement buttons depending on what partner keys have been provided
                if (FDonorKey > 0)
                {
                    btnDonorGiftStatement.Enabled     = true;
                    mniFileDonorGiftStatement.Enabled = true;
                }
                else
                {
                    btnDonorGiftStatement.Enabled     = false;
                    mniFileDonorGiftStatement.Enabled = false;
                }

                if (FRecipientKey > 0)
                {
                    btnRecipientGiftStatement.Enabled     = true;
                    mniFileRecipientGiftStatement.Enabled = true;
                }
                else
                {
                    btnRecipientGiftStatement.Enabled     = false;
                    mniFileRecipientGiftStatement.Enabled = false;
                }
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }