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

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

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