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
close icon

Need header row text to left justify

Using the following code I am having problems getting the cell text in the header row to left justify. Can you help please?

---

// ------------------------------
// describe StatusText column
// ------------------------------
if (pd.Name == "StatusText")
{
col.HeaderText = "Status Message";
col.MappingName = "StatusText";
col.ReadOnly = true;

// update grid styles for this column
col.StyleInfo.CellType = "TextBox";
col.StyleInfo.CellValueType = typeof(String);
col.StyleInfo.CellTipText = "Status message";
col.StyleInfo.MaxLength = 255;
col.StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Left;
}

1 Reply

JJ Jisha Joy Syncfusion Team March 18, 2010 04:35 AM UTC

Hi George,

You need to ignore ReadOnly style temporarly to apply styles to the readOnly cells. See the modifed code:

col.HeaderText = "Status Message";
col.MappingName = "StatusText";
col.ReadOnly = true;


this.gridDataBoundGrid1.Model.IgnoreReadOnly = true;

// update grid styles for this column
col.StyleInfo.CellType = "TextBox";
col.StyleInfo.CellValueType = typeof(String);
col.StyleInfo.CellTipText = "Status message";
col.StyleInfo.MaxLength = 255;
col.StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Left;


this.gridDataBoundGrid1.Model.IgnoreReadOnly = false;



Regards,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon