Ariez Posted July 16, 2003 Posted July 16, 2003 How do i get to show my dataset column captions instead of their actual name in the datagrid column headers? Quote Auto-suggestion: "I have a life" Uncontroled thinking: "So what the.."
donnacha Posted July 16, 2003 Posted July 16, 2003 Hi Ariez, have you tried using the DataGridTableStyle. e.g. Dim ts1 As New DataGridTableStyle() ts1.MappingName = "Codes" Dim TextCol3 As New DataGridTextBoxColumn() TextCol3.MappingName = "Code_Field1" TextCol3.HeaderText = "Code1" ts1.GridColumnStyles.Add(TextCol3) ' Add the DataGridTableStyle objects to the collection. dgrid.TableStyles.Add(ts1) Quote Hamlet
Ariez Posted July 16, 2003 Author Posted July 16, 2003 (edited) donnacha Thanks a lot.!!!!!.. i used it to map the dataset column captions like this. dgEmployees.DataSource = dv Dim dgs As New DataGridTableStyle() Dim i As Integer Dim tbl As DataTable = DsAllEmployees1.Employees Dim tb(tbl.Columns.Count - 1) As DataGridTextBoxColumn dgs.MappingName = "Employees" For i = 0 To tbl.Columns.Count - 1 tb(i) = New DataGridTextBoxColumn() tb(i).MappingName = tbl.Columns(i).ColumnName tb(i).HeaderText = tbl.Columns(i).Caption dgs.GridColumnStyles.Add(tb(i)) Next dgEmployees.TableStyles.Add(dgs) But there has to be a way to bind the dataset col caption to the datagrid col header without all this... (I lost all the column apperrance i set at design!) if anyone knows please let me know. anyways donnacha thanx, this works and thats what we need.. Edited July 16, 2003 by Ariez Quote Auto-suggestion: "I have a life" Uncontroled thinking: "So what the.."
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.