Click here to Skip to main content
15,923,789 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to add alias to column because it must be Arabic, How can i add space ?

What I have tried:

C#
var CustomersQuery = from c in DB.Customers
                                 select new {
                                     اسم العميل = c.CustomerName
                                 };
            metroGridCustomers.DataSource = CustomersQuery.ToList();
Posted
Updated 23-Sep-17 11:52am

You can't. The column alias is a C# identifier, which cannot contain any whitespace.

2.4.2 Identifiers (C#)[^]

You'll need to find another way to customise the column header.
 
Share this answer
 
I have solved my issue by below code because it's the simplest
C#
metroGridCustomers.Columns[0].HeaderText = "Customer Name";
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900