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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change header text in grid?

Thread ID:

Created:

Updated:

Platform:

Replies:

107444 Mar 2,2013 04:16 AM UTC Mar 5,2013 10:59 AM UTC WinRT 3
loading
Tags: SfGridSplitter
Gary Pansino
Asked On March 2, 2013 04:16 AM UTC

I have the datagrid preview bound to an observable collection.  The columns do not show unless I have autogenerate columns ticked, which  then assigns the property name from the model, which is nice, but is not what I would like the end user to see.

Prakash Selvaraj [Syncfusion]
Replied On March 4, 2013 09:51 AM UTC

Hi Gary,

 

Thank you for choosing Syncfusion Controls.

 

We have analysed your query, if you set AutoGenerateColumns as true, then the Grid will populate the columns automatically according to the Data present in the Model and HeaderText  will also be automatically set to the GridColumns. If you want to set the HeaderText as per your desire then  you need to define the GridColumns as in the below code snippet.

 

Code Snippet [Xaml]:

<syncfusion:SfDataGrid.Columns>

  <syncfusion:GridTextColumn HeaderText="ID" MappingName="EmployeeId" />

  <syncfusion:GridTextColumn HeaderText="Name" MappingName="EmployeeName" />

  <syncfusion:GridTextColumn HeaderText="Title" MappingName="EmployeeDesignation" />

</syncfusion:SfDataGrid.Columns>

 

Please let us know if you need further assistance.

 

Regards,

Prakash S.


Gary Pansino
Replied On March 4, 2013 04:08 PM UTC

Thank you.  Very helpful.

A related question ... how do you hide/show columns?  

Prakash Selvaraj [Syncfusion]
Replied On March 5, 2013 10:59 AM UTC

Hi Gary,

 

We have analysed your query. You can achieve your requirement by setting true/false to IsHidden property in GridColumns. Please refer the following code snippet.

 

Code Snippet [C#]:

 

<syncfusion:SfDataGrid.Columns>

                <syncfusion:GridTextColumn HeaderText="Id"

                                           IsHidden="False"

                                           MappingName="EmployeeId" />

                <syncfusion:GridTextColumn HeaderText="Name"

                                           IsHidden="True"

                                           MappingName="EmployeeName" />

                <syncfusion:GridTextColumn HeaderText="Title"

                                           IsHidden="False"

                                           MappingName="EmployeeDesignation" />

</syncfusion:SfDataGrid.Columns>

 

Please let us know if you need further assistance.

 

Regards,

Prakash S.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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

;