public static bool UpdateNewValueIntoCellDatail <TEntityItem>(object newValue, GridViewCellDetail <TEntityItem> cellDetail) where TEntityItem : IEntity <int> { bool updateSuccess = true; if (cellDetail.ColumnType == GridViewColumnType.EditBox || cellDetail.ColumnType == GridViewColumnType.ComboBox) { if (cellDetail.ValueType == GridViewCellValueType.String) { if (newValue == null) { cellDetail.Value = string.Empty; } else { cellDetail.Value = newValue.ToString(); } } else if (cellDetail.ValueType == GridViewCellValueType.Decimal) { string tempDecimalValue = null; if (newValue != null) { tempDecimalValue = newValue.ToString(); } try { decimal?newDecimalValue = LocalizationUtils.FormatStringTo2Decimal(tempDecimalValue); cellDetail.Value = newDecimalValue; } catch { updateSuccess = false; } } else if (cellDetail.ValueType == GridViewCellValueType.Integer) { string tempIntValue = null; if (newValue != null) { tempIntValue = newValue.ToString(); } try { int?intValue = Convertor.ConvertToInteger(tempIntValue); cellDetail.Value = intValue; } catch { updateSuccess = false; } } else if (cellDetail.ValueType == GridViewCellValueType.Percentage) { string tempPercentageValue = null; if (newValue != null) { tempPercentageValue = Convert.ToString(newValue, CultureInfo.InvariantCulture).Replace("%", string.Empty); } try { decimal?percentValue = LocalizationUtils.FormatStringToRate(tempPercentageValue); cellDetail.Value = percentValue; } catch { updateSuccess = false; } } } else if (cellDetail.ColumnType == GridViewColumnType.DateChooser) { string tempDateTimeValue = null; if (newValue != null) { tempDateTimeValue = newValue.ToString(); } cellDetail.Value = DateTimeUtils.ToDateTime(tempDateTimeValue); } return(updateSuccess); }