c# - How to set headers for columns in DataGridView, where data is populated from a sql query -


i have following code working, want display own column names each column rather ones in database. there anyway can that?

sqlcommand cmd = new sqlcommand(); cmd.commandtype = commandtype.storedprocedure; cmd.commandtext = "total_registration"; cmd.connection = con; using (sqldataadapter = new sqldataadapter(cmd.commandtext, con)) {             datatable t = new datatable();     a.fill(t);      grid.datasource = t; } 

after binding datasource set column header text explicitly

grid.datasource = t; grid.column["id"].headertext  = "identifier"; 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -