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. Web Development
  3. ASP.NET
  4. create column of datagrid

create column of datagrid

Scheduled Pinned Locked Moved ASP.NET
questioncsharpvisual-studiohelp
2 Posts 2 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.
  • P Offline
    P Offline
    ptvce
    wrote on last edited by
    #1

    i have a datagrid that i want create the column of datagrid myself. i write this code but its not right in visual studio 2005 how can i do this work? BoundColumn dgColStord = new BoundColumn(); dgColStord.HeaderText = dsHeader.Tables[0].Rows[i]["stord_desc"].ToString(); dgColStord.DataField = i.ToString(); dgColStord.Columns.Add(dgColStord); the last line is not right it give error for columns.

    I 1 Reply Last reply
    0
    • P ptvce

      i have a datagrid that i want create the column of datagrid myself. i write this code but its not right in visual studio 2005 how can i do this work? BoundColumn dgColStord = new BoundColumn(); dgColStord.HeaderText = dsHeader.Tables[0].Rows[i]["stord_desc"].ToString(); dgColStord.DataField = i.ToString(); dgColStord.Columns.Add(dgColStord); the last line is not right it give error for columns.

      I Offline
      I Offline
      iamrashida83
      wrote on last edited by
      #2

      check that what is the value of i? coz i's value shd be the name of column in the datasource whose value will be set in the bound column why dont u try using a template column and sets the value in that columns coz bound column always requires a column name in the DataField here in ur code i seems to be an index

      Regards, Rashida Jabeen http://www.akaas.net[^]

      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