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.

GridListControl - Column Header Text

Thread ID:

Created:

Updated:

Platform:

Replies:

54541 Jan 10,2007 08:22 PM Nov 10,2016 03:38 AM Windows Forms 5
loading
Tags: GridControl
Sreenivasa Ponnaluru
Asked On January 10, 2007 08:22 PM

How to change the column header text in the GridListControl.

Administrator [Syncfusion]
Replied On January 10, 2007 11:20 PM

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 04:59 AM

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 12:06 AM

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 01:54 AM

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 03:38 AM

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.

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.

;