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. reading the gridview cell value

reading the gridview cell value

Scheduled Pinned Locked Moved ASP.NET
javascriptdatabase
2 Posts 1 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.
  • S Offline
    S Offline
    Sunil Wise
    wrote on last edited by
    #1

    i have used this javascript and code for selecting a row in gridview. From this i'll be getting index of the row. its working fine but what i want is the cell value(of any columm) of that selected row can anybody tell me what to do to read the cell value.

    function onGridViewRowSelected(rowIdx)
    { var selRow = getSelectedRow(rowIdx);
    if (curSelRow != null)
    {curSelRow.style.backgroundColor = '#ffffff';}
    if (null != selRow)
    { curSelRow = selRow;
    curSelRow.style.backgroundColor = '#ffff99';
    document.getElementById('txtId').value =rowIdx ;}
    }
    code:
    protected void gvAuditErrors_RowCreated(object sender, GridViewRowEventArgs e)
    { if (e.Row.RowType == DataControlRowType.DataRow)
    {e.Row.Attributes.Add("onclick", "onGridViewRowSelected('"

    • m_iRowIdx.ToString() + "')");}
      m_iRowIdx++;}
      }

    thanks in advance:):)

    S 1 Reply Last reply
    0
    • S Sunil Wise

      i have used this javascript and code for selecting a row in gridview. From this i'll be getting index of the row. its working fine but what i want is the cell value(of any columm) of that selected row can anybody tell me what to do to read the cell value.

      function onGridViewRowSelected(rowIdx)
      { var selRow = getSelectedRow(rowIdx);
      if (curSelRow != null)
      {curSelRow.style.backgroundColor = '#ffffff';}
      if (null != selRow)
      { curSelRow = selRow;
      curSelRow.style.backgroundColor = '#ffff99';
      document.getElementById('txtId').value =rowIdx ;}
      }
      code:
      protected void gvAuditErrors_RowCreated(object sender, GridViewRowEventArgs e)
      { if (e.Row.RowType == DataControlRowType.DataRow)
      {e.Row.Attributes.Add("onclick", "onGridViewRowSelected('"

      • m_iRowIdx.ToString() + "')");}
        m_iRowIdx++;}
        }

      thanks in advance:):)

      S Offline
      S Offline
      Sunil Wise
      wrote on last edited by
      #2

      plz help me out of this problem

      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