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. Data Grid --> Data Key Field

Data Grid --> Data Key Field

Scheduled Pinned Locked Moved ASP.NET
questioncss
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.
  • W Offline
    W Offline
    wongeva
    wrote on last edited by
    #1

    In my Web form I have DataGrid1 and want to add 2 cols in DataGrid1.DataKeyField property. If I had 1 col. it would be DataGrid1.DataKeyField = "ColName1", but how can I add another more "ColName2"?

    C 1 Reply Last reply
    0
    • W wongeva

      In my Web form I have DataGrid1 and want to add 2 cols in DataGrid1.DataKeyField property. If I had 1 col. it would be DataGrid1.DataKeyField = "ColName1", but how can I add another more "ColName2"?

      C Offline
      C Offline
      Chetan Ranpariya
      wrote on last edited by
      #2

      Hi, If you r working on asp.net 2.0 then to get this facility you should use GridView Control. Gridview has property called "DataKeyNames" which you can set to comma separated column names and you can access their values as following. gv.DataKeys[keindex].Values[columnindex].ToString() I hope this will help you.

      Thanks and Regards, Chetan Ranpariya

      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