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

GridListControl - Column Header Text

Thread ID:

Created:

Updated:

Platform:

Replies:

54541 Jan 11,2007 01:22 AM UTC Nov 10,2016 08:38 AM UTC WinForms 5
loading
Tags: GridControl
Sreenivasa Ponnaluru
Asked On January 11, 2007 01:22 AM UTC

How to change the column header text in the GridListControl.

Administrator [Syncfusion]
Replied On January 11, 2007 04:20 AM UTC

Hi Sreeni,

Currently there is no property settings that you can used to change these column headers. But you can change them using the PrepareViewStyleInfo event handler. This event is a member of the embedded GridControl that is a member of the GridListControl.



Below are some code snippets.

//hook the PrepareViewStyleInfo event

this.gridListControl1.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(PrepareViewStyleInfo);

private void PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if(e.ColIndex > 0 && e.RowIndex == 0)
{
switch (e.ColIndex)
{
case 1:
e.Style.Text = "NameCol1";
break;
case 2:
e.Style.Text = "NameCol2";
break;
case 3:
e.Style.Text = "NameCol3";
break;
default:
break;
}
}
}

Best Regards,
Haneef

Truong
Replied On November 9, 2016 09:59 AM UTC

HOW CAN I CHANGE COLUMNS NAME WITHOUT THIS EVENT ? 

I WANT TO CHANGE COLUMNS WHEN I DEFINE GRIDLISTCONTROL

EXAMPLE HIDE A COLUMN :

gridListControl2.Grid.HideCols["ID"] = true;

Piruthiviraj Malaimelraj [Syncfusion]
Replied On November 10, 2016 05:06 AM UTC

Hi Troung, 

Thanks for the update. 
 
By default, the GridListControl used to populate the values from the underlying data source. In GridListControl, the table styles can’t be customized based on the indices of the columns or cells directly. So customizing the header text or any styles can be achieved by only using the PrepareViewStyleInfo or QueryCellInfo events. So we request you to use those events for your requirements. Thanks for your understandings. 
 
Regards, 
Piruthiviraj 


Truong
Replied On November 10, 2016 06:54 AM UTC

Can you show me how to use QueryCellInfo events to get a text of a textbox then set into current cell
---------------------------
gridListControl1.Grid[gridListControl1.Grid.CurrentCell.RowIndex, 2].Text = 
TongPhaChe_Label.Text ;

Piruthiviraj Malaimelraj [Syncfusion]
Replied On November 10, 2016 08:38 AM UTC

Hi Truong, 

Thanks for the update. 

We have provided the solution to change the cell text using QueryCellInfo event in the forum #127335. Please follow-up with that forum and let us know if you have any other queries. 

Regards, 
Piruthiviraj 


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

;