AD
Administrator
Syncfusion Team
July 8, 2003 08:43 AM UTC
In a GridDataBoundGrid, you should use the GridBoundColumn.StyleInfo object to set column styles. For each column, you can get this object through either from the grid.GridBoundColumns collection if you have explicitly added GridBoundColumns to your grid, or from grid.Binder.InternalColumns if you have not added them.
Also, TextAlign is used to position text relative to a cell button. If you want to align text in teh cell, then use the HorizontalAlignment property instead of TextAlign.
this.grid.Binder.InternalColumns["Col2"].StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Right;
ES
Eli Smadar
July 8, 2003 09:15 AM UTC
I tried using the GridBoundColumnsColllection as well and nothing seems to help. Here is the code i am using.
GridBoundColumnsCollection colCols = this.grdLines.GridBoundColumns;
GridBoundColumn col;
//Name
col = new GridBoundColumn();
col.HeaderText = "Name";
col.MappingName = "Name";
col.ReadOnly = true;
col.StyleInfo.BackColor = SystemColors.ControlLight;
colCols.Add(col);
AD
Administrator
Syncfusion Team
July 8, 2003 10:03 AM UTC
Don't set ReadOnly = true until the last change. If you set it, you will not be able to programatically change the style either unless you have explicitly set grid.IgnoreReadOnly = true before you start changing things. Then later you would want to turn IgnoreReadOnly off so the column will not ignore the readonly flag.
ES
Eli Smadar
July 8, 2003 10:19 AM UTC
The HorizontalAlign worked - Thank you.
Sorry but the backcolor still not working.
Could it be any setting in the grid?
AD
Administrator
Syncfusion Team
July 8, 2003 02:51 PM UTC
I think it should work. Attached is a little project where I copied and pasted your code, and it seems to work there. What is different about what you are doing?
ES
Eli Smadar
July 9, 2003 10:48 AM UTC
Thanks Clay.
I think i found the bug.
If you set the background Image to something and then delete it - No more backcolor influance.
When with a backgroundImage then i couldn't set the backcolor at all - why?
Eli