Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在asp.net C中从焦点事件中的Gridview文本框中获取行索引#_Asp.net_C# 4.0 - Fatal编程技术网

如何在asp.net C中从焦点事件中的Gridview文本框中获取行索引#

如何在asp.net C中从焦点事件中的Gridview文本框中获取行索引#,asp.net,c#-4.0,Asp.net,C# 4.0,我通过使用templatefield在Gridview中使用Textbox。一切都很顺利。但我的问题是,每当文本框获得焦点时,我都需要该gridview的行索引。 你能帮助我吗? 提前谢谢也许这个 private void getCurrentCellButton_Click(object sender, System.EventArgs e) { string msg = String.Format("Row: {0}, Column: {1}", dataGridView1.Cu

我通过使用templatefield在Gridview中使用Textbox。一切都很顺利。但我的问题是,每当文本框获得焦点时,我都需要该gridview的行索引。
你能帮助我吗? 提前谢谢

也许这个

private void getCurrentCellButton_Click(object sender, System.EventArgs e)
{
  string msg = String.Format("Row: {0}, Column: {1}",
    dataGridView1.CurrentCell.RowIndex,
    dataGridView1.CurrentCell.ColumnIndex);
  MessageBox.Show(msg, "Current Cell");
}