Special Character in Property/Title Column in DataGrid

Hi,

I across of problem/challenge :wink: which is special character in datagrid.

DataGrid takes data from SQL, however name of some columns are "GM\Test" or "DM\Apple"(DM & backslash & Apple).

All data are display as should however for sorting it doesn't work.

I was tried some workaround but it give me error like:

Error: Invalid pattern 'DM\Apple' at offset 5. Unrecognized escape sequence \S. (at index 0) ---> System.Text.RegularExpressions.RegexParseException: Invalid pattern 'DM\Apple' at offset 5. Unrecognized escape sequence \S.

   at System.Text.RegularExpressions.RegexParser.ScanCharEscape()

I made quick tests on your Blazor DataGrid Component - Dynamic Data | Free UI Components by Radzen

with this changes (just for showing problem)

@using System.Linq.Dynamic.Core

<RadzenDataGrid @bind-Value=@selectedItems Data="@data" TItem="IDictionary<string, object>" ColumnWidth="200px"
                AllowFiltering="true" FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterMode="FilterMode.Advanced" AllowPaging="true" AllowSorting="true">
    <Columns>
        @foreach (var column in columns)
        {
            <RadzenDataGridColumn @key=@column.Key Title="@column.Key" Type="column.Value"
                                  Property="@PropertyAccess.GetDynamicPropertyExpression(column.Key, column.Value)">
                <Template>
                    @context[@column.Key]
                </Template>
            </RadzenDataGridColumn>
        }
    </Columns>
</RadzenDataGrid>

@code {
    IList<IDictionary<string, object>> selectedItems;

    public IEnumerable<IDictionary<string, object>> data { get; set; }

    public IDictionary<string, Type> columns { get; set; }

    public enum EnumTest
    {
        EnumValue1,
        EnumValue2
    }

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();

        columns = new Dictionary<string, Type>()
        {
            { "EmployeeID", typeof(string) },
            { @"DM\Apple", typeof(string) },
            { "FirstName", typeof(string) },
            { "LastName", typeof(string) },
          
        };

        foreach (var i in Enumerable.Range(0, 50))
        {
            columns.Add($"Column{i}", typeof(string));
        }

        data = Enumerable.Range(0, 100).Select(i =>
        {
            var row = new Dictionary<string, object>();

            foreach (var column in columns)
            {
                row.Add(
                    column.Key,
                    @"DM\Apple"
                );
            }

            return row;
        });
    }
}

Can you help me with that ?

Iā€™m afraid that we are not aware of any solution for such problem.