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.

align text header of a column in grid control

Thread ID:

Created:

Updated:

Platform:

Replies:

43311 Apr 20,2006 06:11 AM Apr 20,2006 08:45 AM Windows Forms 5
loading
Tags: GridControl
Fady Sayegh
Asked On April 20, 2006 06:11 AM

hi to all, how can align the text header of a column to the left or to the right. by default all the columns are align center best regards and thanks in advance fady

Administrator [Syncfusion]
Replied On April 20, 2006 07:26 AM

Hi Fady, Please try this code //For Left this.gridDataBoundGrid1.BaseStylesMap["Column Header"].StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Left; //For Right this.gridDataBoundGrid1.BaseStylesMap["Column Header"].StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Right; Let us know if this helps Regards, Haneef

Fady Sayegh
Replied On April 20, 2006 07:48 AM

Hi Haneef, thanks to your reply, but i''m working with GridControl and not GridDataBoundGrid. in GridControl i write these two lines gridControl1.ColCount = 2; gridControl1.BaseStylesMap[1].StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Left; and the second line gives me this error : System.NullReferenceException best regards and thanks in advance fady

Administrator [Syncfusion]
Replied On April 20, 2006 08:10 AM

Hi Fady, You need to use this code for GridControl.Here is a code snippet this.gridControl1.BaseStylesMap["Column Header"].StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Left; Here is a sample. http://www.syncfusion.com/Support/user/uploads/gc123_988ec04f.zip Let us know if this helps. Regards, Haneef

Fady Sayegh
Replied On April 20, 2006 08:22 AM

Hi Haneef, thanks to your reply it works. the code you gave me align the header text of all columns. but can i align the header text of the first column to the left and align the header text of the second column to the right best regards and thanks in advance fady

Administrator [Syncfusion]
Replied On April 20, 2006 08:45 AM

Hi Fady, Try this code //For First Column this.gridControl1[0,1].HorizontalAlignment = GridHorizontalAlignment.Left; //For Second Column this.gridControl1[0,2].HorizontalAlignment = GridHorizontalAlignment.Right; Thanks for your interest in Syncfusion Products. Regards, Haneef

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.

;