|
this.sfDataGrid.QueryUnboundColumnValue += SfDataGrid_QueryUnboundColumnValue;
this.sfDataGrid.FilterItemsPopulating += SfDataGrid_FilterItemsPopulating;
private void SfDataGrid_FilterItemsPopulating(object sender, GridFilterItemsPopulatingEventArgs e) {
if (e.Column.MappingName == "UnboundColumn")
{
e.FilterControl.AdvancedFilterType = AdvancedFilterType.NumberFilter;
e.FilterControl.SetColumnDataType(typeof(decimal?));
e.FilterControl.AscendingSortString = GridResourceWrapper.SortNumberAscending;
e.FilterControl.DescendingSortString = GridResourceWrapper.SortNumberDescending;
}
}
private void SfDataGrid_QueryUnboundColumnValue(object sender, GridUnboundColumnEventsArgs e)
{
if (e.UnBoundAction != UnBoundActions.QueryData)
return;
decimal? strikePrice = Convert.ToDecimal(e.Record.GetType().GetProperty("CustomerID")?.GetValue(e.Record));
e.Value = decimal.Round((decimal)strikePrice,1);
} |
|
private void SfDataGrid_QueryUnboundColumnValue(object sender, GridUnboundColumnEventsArgs e)
{
if (e.UnBoundAction != UnBoundActions.QueryData)
return;
//define the string format as N1
var strikePrice =Convert.ToDecimal((e.Record.GetType().GetProperty("CustomerID")?.GetValue(e.Record))).ToString("N1");
//then convert the string into decimal
e.Value = Convert.ToDecimal(strikePrice);
} |