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. How to extract a table cell's textbox data?

How to extract a table cell's textbox data?

Scheduled Pinned Locked Moved C#
helptutorialquestion
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.
  • J Offline
    J Offline
    jmelgar
    wrote on last edited by
    #1

    I want to traverse a 3 column table to get the 3rd column's textbox data. The first 2 cell's have text assigned to the cell (cell.text="xyz"). When I run this, column 2 cell's text is read with no problem: for(int i=1; i<=TasksTable.Rows.Count-1; i++) { string txtColumn2 = TasksTable.Rows[i].Cells[1].Text; } However I get error message when I try to use FindControl or do something like: for(int i=1; i<=TasksTable.Rows.Count-1; i++) { // Or like.. txtColumn3 = TasksTable.Rows[i].Cells[2].Text; TextBox txtColumn3 = (TextBox)TasksTable.Rows[i].Cells[2].FindControl ("Hours"); } Your syntax help would be appreciated. Thanks in advance if you don't hear from me, Jim.:confused:

    I 1 Reply Last reply
    0
    • J jmelgar

      I want to traverse a 3 column table to get the 3rd column's textbox data. The first 2 cell's have text assigned to the cell (cell.text="xyz"). When I run this, column 2 cell's text is read with no problem: for(int i=1; i<=TasksTable.Rows.Count-1; i++) { string txtColumn2 = TasksTable.Rows[i].Cells[1].Text; } However I get error message when I try to use FindControl or do something like: for(int i=1; i<=TasksTable.Rows.Count-1; i++) { // Or like.. txtColumn3 = TasksTable.Rows[i].Cells[2].Text; TextBox txtColumn3 = (TextBox)TasksTable.Rows[i].Cells[2].FindControl ("Hours"); } Your syntax help would be appreciated. Thanks in advance if you don't hear from me, Jim.:confused:

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

      if this is a datatable MessageBox.Show(MyDataSet.Tables["myTable].Rows[0]["MyFirstColumn"].ToString()); Like wise MessageBox.Show(MyDataSet.Tables["myTable].Rows[0][0].ToString()); I'm not an expert yet, but I play one at work. Yeah and here too.

      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