如何在两个datagridviews中选择相同的记录(行) [英] How to select the same record(row) in two datagridviews

查看:110
本文介绍了如何在两个datagridviews中选择相同的记录(行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个带有两个datagridviews的表单.相同的记录显示在两个datagridviews中.

当我在第一个datagridview中选择一行时,那么它还必须在第二个datagridview中选择同一行.

我试图写以下内容

如果(dtgAllTerminals.CurrentRow.Cells ["ID"].Value.ToString()= dtgUpdatedTerminals.CurrentRow.Cells ["ID"].Value.ToString();

在哪里可以更改编码?

谢谢

I have created a form with two datagridviews on the form. The same records are displayed in both datagridviews.

When I select a row in the first datagridview, then it must also select the same row in the second datagridview.

I have tried to write the following

if (dtgAllTerminals.CurrentRow.Cells["ID"].Value.ToString() = dtgUpdatedTerminals.CurrentRow.Cells["ID"].Value.ToString();

Where can I change the coding?

Thanks

推荐答案

您还在编辑那些datagridview中的数据吗?还是只显示数据?

那些gridview是从相同的源表或数据库表获取数据吗?

您是否要这样做:

Are you also editing the data in of the those datagridview or you are just displaying data?

Are those gridviews getting the data from the same source or database table?

Are you trying to do this:

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
  {
      GridView2.SelectedIndex = GridView1.SelectedIndex;
  }


这篇关于如何在两个datagridviews中选择相同的记录(行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆