Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

C#
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.
Posted
Updated 30-Dec-10 22:04pm
v2
Comments
Sandeep Mewara 30-Dec-10 0:35am    
What have you tried, share the code. This does not sound right. You should be able to show two tables in two grids without any issue.

Use 'Improve Question' and edit/update with necessary code.

1 solution

use dataset[table index]..for accessing specific table ..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900