thesmashest
asked on
Column Header and Column Name
I have a DataGrid with a DataTable as its source. The DataTable has multiple columns.
Is it possible to have a column header that is different than the column's name. (i.e. The column header on the DataGrid would display "Full Customer Name" but I the actual column name would be Full_Name.
Is it possible to have a column header that is different than the column's name. (i.e. The column header on the DataGrid would display "Full Customer Name" but I the actual column name would be Full_Name.
Not sure about the DataGrid. I always use a DataGridView... Why don't you try that? It has a Columns Property, which you can add columns to and set the HeaderText, which is just what you'r looking for.
ASKER
Correction....I am using a DataGridView. I defined the columns only in the DataTable like so: DataTable.Columns.Add("Exa mple") and then I bind the DataTable to the DataGridView.
How do I create a column in a DataGridView.....and what happens when I bind the DataTable to the DataGridView....do the columns' settings of the DataTable override the columns' settings of the DataGridView?
How do I create a column in a DataGridView.....and what happens when I bind the DataTable to the DataGridView....do the columns' settings of the DataTable override the columns' settings of the DataGridView?
ASKER
Ok, I have created all columns in the DataGridView. All the DataRows are located in the DataTable....how do I bind only DataRows of the DataTable to the DataGridView. I tried to do this: DataGridView.Rows = DataTable.Rows but it's not working
try: DatagridView.Datasource=Da taTable
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.