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: November 16, 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?

Platform: WPF |
Control: SfDataGrid |
Published Date: July 29, 2015 |
Last Revised Date: December 16, 2015 |
.NET Framework: 4.5
Tags: columns

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

ADD COMMENT
You must log in to leave a comment
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

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

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