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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

align text header of a column in grid control

Thread ID:

Created:

Updated:

Platform:

Replies:

43311 Apr 20,2006 10:11 AM UTC Apr 20,2006 12:45 PM UTC WinForms 5
loading
Tags: GridControl
Fady Sayegh
Asked On April 20, 2006 10:11 AM UTC

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 11:26 AM UTC

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 11:48 AM UTC

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 12:10 PM UTC

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 12:22 PM UTC

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 12:45 PM UTC

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.

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

;