Getting value from a Gridview cell

前端 未结 1 1152
隐瞒了意图╮
隐瞒了意图╮ 2020-12-19 05:21

I\'m trying to get an int value from a GridView. Here is the screenshot of my gridview.

\"gridview

相关标签:
1条回答
  • 2020-12-19 06:20

    SelectedRows only returns rows that have been selected; without a selection you won't get anything. Instead of int bigStore = Convert.ToInt32(grdOrder.SelectedRow.Cells[2].Text); try:

    int rowIndex = Convert.ToInt32(e.CommandArgument); // Get the current row
    int bigStore = Convert.ToInt32(grdOrder.Rows[rowIndex].Cells[2].Text);
    
    0 讨论(0)
提交回复
热议问题