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. DataGrid row value

DataGrid row value

Scheduled Pinned Locked Moved C#
databasehelp
4 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
    webhay
    wrote on last edited by
    #1

    Hello all, i am using Datagrid to dispay row directly from my database but i need to click on one row to open details for this row from another table in the database where i can hang the value for the row with specifc row like in the combobox ValueMember Thanks for help Hoho

    S 1 Reply Last reply
    0
    • W webhay

      Hello all, i am using Datagrid to dispay row directly from my database but i need to click on one row to open details for this row from another table in the database where i can hang the value for the row with specifc row like in the combobox ValueMember Thanks for help Hoho

      S Offline
      S Offline
      Stanciu Vlad
      wrote on last edited by
      #2

      DataRowView currentRowInTheGrid = (DataRowView)this.dataGrid1.BindingManager[this.dataGrid1.DataSource, this.dataGrid1.DataMember].Current;

      I hope you understand...because is a rough world out there...

      W 1 Reply Last reply
      0
      • S Stanciu Vlad

        DataRowView currentRowInTheGrid = (DataRowView)this.dataGrid1.BindingManager[this.dataGrid1.DataSource, this.dataGrid1.DataMember].Current;

        I hope you understand...because is a rough world out there...

        W Offline
        W Offline
        webhay
        wrote on last edited by
        #3

        Thanks so much about your help but i need to know the ID of this current record to select the related details with this ID. thank hoho

        S 1 Reply Last reply
        0
        • W webhay

          Thanks so much about your help but i need to know the ID of this current record to select the related details with this ID. thank hoho

          S Offline
          S Offline
          Stanciu Vlad
          wrote on last edited by
          #4

          Having the dataRowView you can obtain the coresponding dataRow :

          DataRowView currentRowInTheGrid = (DataRowView)this.dataGrid1.BindingManager[this.dataGrid1.DataSource, this.dataGrid1.DataMember].Current;
          DataRow currentRow = currentRowInTheGrid.Row;

          object myId = currentRow["myIdColumnName"]; // is the same as object myId = currentRowInTheGrid["myIdColumnName"];

          I hope you understand...because is a rough world out there...

          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