Get TextBox value from GridView cell

前端 未结 1 1985
一生所求
一生所求 2021-01-29 02:00

I have a GridView containing template fields. Each template field contains a TextBox. Last column of the GridView contains SELECT command field.

On click of SELECT, I wa

相关标签:
1条回答
  • 2021-01-29 02:30

    You need to look inside of a Cell, not inside of a Row, try this:

    ((TextBox)GridView1.Rows[e.Row.RowIndex].Cells[iCellIndex].FindControl("TextBox1")).Text;
    

    Where you need to supply iCellIndex - index of the cell that has the textbox.

    Oh and use square brackets to indicate collection item.

    0 讨论(0)
提交回复
热议问题