internal void Merge(TableColumn col) { Title = col.Title ?? Title; CellDisplayFormat = col.CellDisplayFormat ?? CellDisplayFormat; CellNullDisplayText = col.CellNullDisplayText ?? CellNullDisplayText; CellUihint = col.CellUihint ?? CellUihint; CellVisible = col.CellVisible; CellContent = col.CellContent; }
private string GetColumnValue(object row, TableColumn col) { string result = string.Empty; if (string.IsNullOrEmpty(col.CellContent)) { var propertyExplorer = AspFor.ModelExplorer.GetExplorerForModel(row).GetExplorerForProperty(col.For); if (propertyExplorer == null) throw new ArgumentException($"Model does not contain column '{col.For}'"); object value = propertyExplorer.Model; if (!string.IsNullOrEmpty(col.CellDisplayFormat)) result = string.Format(System.Globalization.CultureInfo.CurrentCulture, col.CellDisplayFormat, value); else if (!string.IsNullOrEmpty(col.CellUihint)) result = HtmlHelper.Partial($"{Const.DisplayTemplateViewPath}/{col.CellUihint}", value).ToString(); else result = value?.ToString(); } else { result = col.CellContent.ReplaceStringTokens(AspFor.ModelExplorer.GetExplorerForModel(row)); } if (result == null) { if (col.CellNullDisplayText != null) result = col.CellNullDisplayText; else result = string.Empty; } return result; }
private string GetHeaderValue(TableColumn col) { if (col.Title != null) return col.Title; return col.Id.SplitCamelCase(); }