We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to display the column values when column name contains special characters?

In the SfDataGrid, when special characters are used in the Column.MappingName for DataTable Collection, it results in binding error and the specific column value is not displayed in that column.

In the following code example, the column name contains special character, (“.”) fullstop. So, this column name is interrupted by binding path parser. The System.Windows.Data Error: 40 : BindingExpression path error: 'Na' property not found on 'object' ''DataRowView' (HashCode=9585198)'. BindingExpression:Path=Na.me; DataItem='DataRowView' (HashCode=9585198); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')error is caused in the application since these special characters have meaning in binding path, including full stop (“.”), slash (“/”), and so on.

 

XAML

 

C#

 

You can overcome this issue by wrapping the binding path with square brackets in the Column.DisplayBinding. To display the value in edit mode, you need to do the same for the Column.ValueBinding.

XAML

 

Sample Link:

WPF

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework:
5281 07/29/2015 12/16/2015 WPF SfDataGrid 4.5
Tags:
Did you find this information helpful?
Comments
Somanna Chottekalapanda Mar 01, 2018

Hi,

I know this a very old article. Could you let me know if there is workaround when we are binding a data table to the grid and use AutoGenerateColumns="True"?

Thanks,

Reply
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon