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. Image for the cookie policy date

Changing ColHeader when binding to List of Objects and Editing values

When using a list of objects as datasource:

Is it possible to change the shown header of the column?

Like:

    \< displayname("KoArt")\>

    Public Property PosKostenart As Double

And is it possible to edit the Values directly over the grid?


Thanks in advance :)


1 Reply

AR Arulpriya Ramalingam Syncfusion Team October 10, 2017 11:18 AM UTC

Hi Grozer,   
   
Thanks for using Syncfusion products.   
   
By default, the HeaderText for the columns will be updated from the data source of the Grid. In order to change the header text of a column, the PrepareViewStyleInfo event can be used. In that event the Text property can be used to set the HeaderText for a particular column based on index.    
   
Moreover, the GridListControl is used to display the datasource values and its cell’s type is “Static”. So, the GridListControl does not allowed to edit the cell values at run-time.    
Please make use of the below code, KB link and sample,   
   
Code example:  
   
//Event Triggering   
this.gridListControl1.Grid.PrepareViewStyleInfo += Grid_PrepareViewStyleInfo;   
   
//Event Customization   
private void Grid_PrepareViewStyleInfo(object sender,GridPrepareViewStyleInfoEventArgs e)   
{   
    if (e.RowIndex == 0 && e.ColIndex == 3)   
    {   
        e.Style.Text = "Header1";   
    }   
}   
   
   
   
Note   
Please refer to the below UG for choosing the best grid,   
   
Regards,   
Arulpriya   


Loader.
Live Chat Icon For mobile
Up arrow icon