cannot select the row

How do i select get the row number when i select a row. For example, i select row 3 .. How how i get the value 3 Anyone can help

THis is my code, but it doesn't work

GridViewRow row = gvReceive.SelectedRow;

if (e.CommandName == "SerialNo")

{

lbl1.Visible = true;

lbl2.Visible = true;

lblProdNo.Text = rowCells[2].Text;

txtSerialNo.Visible = true;

}



Answer this question

cannot select the row

  • max-holz

    hi

    Row index is start from 0

    DataGridViewSelectedRowCollection col = dataGridView1.SelectedRows;

    DataGridViewRow row = col[0];

    row.Index



  • mattoby_slim

    hi

    Row index is start from 0

    DataGridViewSelectedRowCollection col = dataGridView1.SelectedRows;

    DataGridViewRow row = col[0];

    row.Index



  • dmadrian

    hi

    Row index is start from 0

    DataGridViewSelectedRowCollection col = dataGridView1.SelectedRows;

    DataGridViewRow row = col[0];

    row.Index



  • cannot select the row