如何在gridview的行命令字段中获取特定单元格的值

时间:2014-05-03 03:27:15

标签: c# asp.net .net

我正在使用以下表达式。

int index = Convert.ToInt32(e.CommandArgument);

我想得到行索引,但索引的值就像0x000000一样。

1 个答案:

答案 0 :(得分:0)

试试这个:

int index = 0;
int.TryParse(e.CommandArgument as string, out index);

不确定您在尝试获取索引的上下文中的问题,但在RowDataBound事件处理程序中,您将获得如下所述的索引:

How to get index of the gridview row

相关问题