private static void performContentValidation(HttpPostedFile postedFile, out OMAMFundPricesCollection fundPricesCollection, ref List <string> validationErrors)
    {
        //needed as you cannot assign values to an out param
        OMAMFundPricesCollection _fundPricesCollection = new OMAMFundPricesCollection();
        List <string>            _tempValidationErrors = validationErrors;

        //set the parsing class to parse the contents
        TextFieldParser textFieldParser = new TextFieldParser();

        setFileSchema(textFieldParser.TextFields);

        textFieldParser.QuoteCharacter    = '"';
        textFieldParser.FirstLineIsHeader = false;
        textFieldParser.FileType          = TextFieldParser.FileFormat.Delimited;
        textFieldParser.Delimiter         = ',';
        textFieldParser.TrimWhiteSpace    = true;

        // Set up event handlers for when a row is read and when a row is read but failes to match the expected schema
        textFieldParser.RecordFound += new TextFieldParser.RecordFoundHandler(
            delegate(ref Int32 currentLineNumber, TextFieldCollection textFields, string lineText)
        {
            string priceType = (string)textFields["Price Type"].Value;
            if (priceType.ToUpper() == "ACC" || priceType.ToUpper() == "INC")
            {
                OMAMFundPrices fundPrices = _fundPricesCollection.AddNew();
                //populate with values in text field array
                fundPrices.BidPrice    = (double?)textFields["Bid Price"].Value;
                fundPrices.OfferPrice  = (double?)textFields["Offer Price"].Value;
                fundPrices.Yield       = (double?)textFields["Yield"].Value;
                fundPrices.Description = (string)textFields["Description"].Value;
                fundPrices.FundCode    = (string)textFields["Fund Code"].Value;
                fundPrices.PriceType   = priceType;
                fundPrices.UploadDate  = (DateTime?)textFields["Price Date"].Value;
                fundPrices.UploadedBy  = 1;
            }
            else
            {
                _tempValidationErrors.Add(
                    string.Format("Line {0}: Unknown Fund Type - '{1}'.", priceType, currentLineNumber));
            }
        });

        textFieldParser.RecordFailed += new TextFieldParser.RecordFailedHandler(
            delegate(ref Int32 CurrentLineNumber, string LineText, string ErrorMessage, ref bool Continue) { _tempValidationErrors.Add(string.Format("Line {0}: {1}", CurrentLineNumber, ErrorMessage)); });

        //// parse the file contents
        textFieldParser.ParseFileContents(postedFile.InputStream);

        //assign temp varables back to the outand ref params
        fundPricesCollection = _fundPricesCollection;
        validationErrors     = _tempValidationErrors;
    }
    /// <summary>
    /// Handles the RowUpdating event of the GridViewUploadedPrices control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewUpdateEventArgs"/> instance containing the event data.</param>
    protected void GridViewUploadedPrices_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow row = GridViewUploadedPrices.Rows[e.RowIndex];

        if (row != null)
        {
            OMAMFundPrices fundPrice = new OMAMFundPrices();
            fundPrice.LoadByPrimaryKey((int)GridViewUploadedPrices.DataKeys[e.RowIndex].Value);
            fundPrice.BidPrice   = double.Parse(((TextBox)row.FindControl("TextBoxBidPrice")).Text);
            fundPrice.OfferPrice = double.Parse(((TextBox)row.FindControl("TextBoxOfferPrice")).Text);
            fundPrice.Yield      = double.Parse(((TextBox)row.FindControl("TextBoxYield")).Text);
            fundPrice.Save();
        }

        GridViewUploadedPrices.EditIndex = -1;
        displayUploadedPrices();
    }