维护两个不同的datagridview并在每个reg中显示一个表 [英] Maintaining two different datagridview and displaying one tables in each- reg

查看:79
本文介绍了维护两个不同的datagridview并在每个reg中显示一个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以单一形式在两个不同的datagridview(使用dataview进行过滤)中分配两个表.如果我使用具有两个datagridviews的单一形式的两个表.我的数据集显示了当前表,而不是datagridview1中先前显示的表.

 私有 无效 DGVMasterSearch_CellClick(对象发​​件人,DataGridViewCellEventArgs e)
        {
            清除();
            如果(DGVMasterSearch.CurrentCell!= && DGVMasterSearch.CurrentCell.Value!= 为空)
            {
                如果(例如,RowIndex >  -1)
                {
                    txtPurchaseID.Text =  .DGVMasterSearch.CurrentRow.Cells ["  PURCHASE_ID"].Value.ToString();
                    txt_po_Oid.Text =  .DGVMasterSearch.CurrentRow.Cells ["  PURCHASE_ORDER_ID"].Value.ToString();
                    txtDate.Text =  .DGVMasterSearch.CurrentRow.Cells ["  DATE"].Value.ToString();
                    txtVendor_Invoice.Text =  .DGVMasterSearch.CurrentRow.Cells ["  VENDOR_INVOICE_NO"].Value.ToString();
                    cmbVendor.Text =  .DGVMasterSearch.CurrentRow.Cells ["  VENDOR_NAME"].Value.ToString();

                }
            }
              dgvPurchaseEntry.Columns.Clear();

            字符串 [] str = {txtPurchaseID.Text," };
            ds = ppt.P_DS(" ,str);
             .dgvPurchaseEntry.DataSource = ds.Tables [ 0 ];
            Totalgridvalues();
            PanelMasterSearch.Hide();

        } 



我在单个页面中使用了三个datagridview.我编写了存储过程以返回这三个datagridviews的表模式.我只想在一个datagridview中搜索一个项目,第二个datagridview将显示详细信息.在这里,我的数据集会发生什么情况,因此将两个表绑定到gridview中.

解决方案

使用数据集[表索引] ..访问特定表.. br/>

How to dispaly two tables in two different datagridview(with dataview for filtering) in single form. if i use two tables in single form with two datagridviews. my dataset displays current table not previous showing in datagridview1.

private void DGVMasterSearch_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            Clear();
            if (DGVMasterSearch.CurrentCell != null && DGVMasterSearch.CurrentCell.Value != null)
            {
                if (e.RowIndex > -1)
                {
                    txtPurchaseID.Text =this.DGVMasterSearch.CurrentRow.Cells["PURCHASE_ID"].Value.ToString();
                    txt_po_Oid.Text = this.DGVMasterSearch.CurrentRow.Cells["PURCHASE_ORDER_ID"].Value.ToString();
                    txtDate.Text = this.DGVMasterSearch.CurrentRow.Cells["DATE"].Value.ToString();
                    txtVendor_Invoice.Text = this.DGVMasterSearch.CurrentRow.Cells["VENDOR_INVOICE_NO"].Value.ToString();
                    cmbVendor.Text = this.DGVMasterSearch.CurrentRow.Cells["VENDOR_NAME"].Value.ToString();

                }
            }
              dgvPurchaseEntry.Columns.Clear();

            string[] str = {txtPurchaseID.Text,"SEARCH" };
            ds= ppt.P_DS("PURCHASE_DETAILS_SEARCH_DELETE",str);
            this.dgvPurchaseEntry.DataSource = ds.Tables[0];
            Totalgridvalues();
            PanelMasterSearch.Hide();

        }



I use three datagridview in single page. I wrote stored procedure to return table schema for these three datagridviews. I just want to search an item in one datagridview and second datagridview will show the details. Here what happens my dataset gives two tables for to bind in gridview.

解决方案

use dataset[table index]..for accessing specific table ..


这篇关于维护两个不同的datagridview并在每个reg中显示一个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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