Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. change datagridview column name

change datagridview column name

Scheduled Pinned Locked Moved C#
questiontutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    benjamin yap
    wrote on last edited by
    #1

    Hi, i have a datagridview and have bounded my datasource. When the gridview is loaded, the column name follows the table attributes name. example catID desc catName I want to rename the column to Cat ID, Description, Category Name How do i do that?

    G N 2 Replies Last reply
    0
    • B benjamin yap

      Hi, i have a datagridview and have bounded my datasource. When the gridview is loaded, the column name follows the table attributes name. example catID desc catName I want to rename the column to Cat ID, Description, Category Name How do i do that?

      G Offline
      G Offline
      Gulfraz Khan
      wrote on last edited by
      #2

      I assume you are talking about the column headers in the datagrid. you can use the column aliases to rename your columns before binding the datasource to the dataset in design mode. if you already have a bounded datasource then You can rename the column headers of the datagrid by using the following sample code MyDataGrid.Columns["catID"].HeaderText = "Cat ID"; MyDataGrid.Columns["desc"].HeaderText = "Description"; MyDataGrid.Columns[2].HeaderText = "Category Name";

      1 Reply Last reply
      0
      • B benjamin yap

        Hi, i have a datagridview and have bounded my datasource. When the gridview is loaded, the column name follows the table attributes name. example catID desc catName I want to rename the column to Cat ID, Description, Category Name How do i do that?

        N Offline
        N Offline
        nelsonpaixao
        wrote on last edited by
        #3

        why don´t you do it in sql???:confused:

        B 1 Reply Last reply
        0
        • N nelsonpaixao

          why don´t you do it in sql???:confused:

          B Offline
          B Offline
          benjamin yap
          wrote on last edited by
          #4

          meaning?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups