TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
phan 0
NA
9
0
datagrid headertext alignment
Apr 26 2005 5:39 AM
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;
Reply
Answers (
1
)
Folder moved/How to change component path?
Get MAC Address