datagrid headertext alignment
hi all,
i want to use different text alignment between datagrid header text and textbox columns.
i use datagrid table style and datagrid textbox column.
pls check my code and tell me how to change.
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = "dtAccount";
DataGridColumnStyle csAccountCode = new DataGridTextBoxColumn();
csAccountCode.MappingName = "Account Code";
csAccountCode.HeaderText = "Account Code";
csAccountCode.Alignment = HorizontalAlignment.Right;
// HeaderText Alignment also change to Right Alignment.
// I want to Center Alignment.
ts.GridColumnStyles.Add(csAccountCode);
dataGridAccount.TableStyles.Add(ts);
string ConnectionString="server=localhost;database=dbaccounting;uid=sa;pwd=sa";
string strSql = "select * from tblAccountHead";
sConn = new SqlConnection(ConnectionString);
sConn.Open();
sAdp = new SqlDataAdapter(strSql, sConn);
sBuilder = new SqlCommandBuilder(sAdp);
dtAccount = new DataTable("dtAccount");
sAdp.Fill(dtAccount);
dataGridAccount.DataSource = dtAccount;