By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,054 Members | 1,345 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,054 IT Pros & Developers. It's quick & easy.

How to set header name of datagridview

P: 1
I used the 2008
I want to set the header name of my datagridview when connect to my database.

here is the problem..
field name of database is "item_code" also show the same in data gridgridview..

I want to change it to be "Item Code" in datagridview, but i don't kow how to code it. When i change it manually the data from database not appear..pls help me solve this..
Jul 30 '12 #1
Share this Question
Share on Google+
4 Replies

Expert Mod 100+
P: 465
Just go into your database and change that value like so "Item Code";
Jul 30 '12 #2

P: 85
you can add an item template or Bound Field in the grid view to bind the data, and set the header text of item template or bound field to Item Code
Aug 7 '12 #3

Expert Mod 5K+
P: 9,731
Mudassir, a DataGridView is not the same as a ASP.NET GridView and does not use item templates.

Anyways, the DataGridView has DataGridViewColumns and a DataGridViewColumn has a HeaderText Property that you can use to set the column's headers.

So, loop through the columns in your DataGridView, find the one with the header text that you don't like, and change it :)

Aug 7 '12 #4

P: 85
Pardon me , i thought it a grid view of
Aug 7 '12 #5

Post your reply

Sign in to post your reply or Sign up for a free account.