// convert strings into dates when getting date column private void _flex_GetUnboundValue(object sender, C1.Win.C1FlexGrid.UnboundValueEventArgs e) { if (_flex.Cols[e.Col].Name == "Date" && (_flex[e.Row, "LegacyDate"]).GetType() != typeof(DBNull)) { // get legacy date string str = (string)_flex[e.Row, "LegacyDate"]; // parse value into DateTime e.Value = DateTime.ParseExact(str, "yyyyMMdd", CultureInfo.InvariantCulture); } }
// convert dates into strings when setting date column private void _flex_SetUnboundValue(object sender, C1.Win.C1FlexGrid.UnboundValueEventArgs e) { if (_flex.Cols[e.Col].Name == "Date") { // get date DateTime date = (DateTime)e.Value; // store as formatted string _flex[e.Row, "LegacyDate"] = string.Format("{0:0000}{1:00}{2:00}", date.Year, date.Month, date.Day); } }
// store value in hashtable using ProductID as key void _flex_SetUnboundValue(object sender, C1.Win.C1FlexGrid.UnboundValueEventArgs e) { DataRowView drv = (DataRowView)_flex.Rows[e.Row].DataSource; _hash[drv["ProductID"]] = e.Value; }