views:

26

answers:

1

I have two tables invoices and receipts

i have to show the alternate data of invoices and receipts in datagrid; condition is that

  • if Date column in INVOICE table matches with invoice columns in RECEIPTS table then the corresponding row of RECEIPTS table should come after INVOICES table row
  • if there is no match then INVOICES table next row will come, and
  • if there is match then then RECEIPTS TABLE row will appear

tables are below

     INVOICES:
Date            Sales           Client          Amount  Paid    Status  Notes
03/27/2008  Chinmoy Panda   ETA Prospect    100         SENT    qwwert
04/30/2008  Amit Sharma     ETA Prospect    1000        FROZEN  
05/13/2008  Chinmoy Panda   ETA Prospect    40000       SENT    
05/17/2008  Chinmoy Panda   ETA Prospect    11111       FROZEN  
10/08/2008  Chinmoy Panda   ETA Prospect    0       GENERATED   
11/05/2008  Chinmoy Panda   ETA Prospect    0       GENERATED   
12/16/2008  Chinmoy Panda   ETA Prospect    333         GENERATED   
02/10/2009  Chinmoy Panda   ETA Prospect    333         GENERATED   
03/20/2009  Chinmoy Panda   ETA Prospect    333         GENERATED   
04/06/2009  Chinmoy Panda   ETA Prospect    333         GENERATED   
05/07/2009  Chinmoy Panda   ETA Prospect    32323       FROZEN  
06/12/2009  Chinmoy Panda   ETA Prospect    333         GENERATED   
07/01/2009  Chinmoy Panda   ETA Prospect    333         GENERATED   
12/08/2009  Chinmoy Panda   ETA Prospect    333         GENERATED   
02/26/2010  Chinmoy Panda   ETA Prospect    333     100:200 CLEARED 
03/02/2010  Chinmoy Panda   ETA Prospect    333         GENERATED   

RECEIPTS:
Date            Sales           Client          Amount  Rupees  Invoice     Notes
03/03/2010  Chinmoy Panda   ETA Prospect    100     200 02/26/2010   
03/03/2010  Chinmoy Panda   ETA Prospect    200     200 02/26/2010   

how can i do that??

A: 

You need to build your DataSource by hand.

Parse through your conditions before binding, adding rows to a programmatically created DataTable with the same columns as are described in your two data tables.

Use the newly created Data Table to bind to your DataGrid/GridView

EDIT

I re-read your question and you really don't have to go through all that hassle --

Use a GridView/DetailsView.

The DetailsView will show the corresponding receipts to an invoice date.

The GridView will list all of the invoices.

Here is a good sample. But no, I'm sorry, I'm not gonna do your homework for you beyond answering questions. This link is pretty self-explanatory.

TheGeekYouNeed
will you explian he above with a demo/example
subodh
ok, thakns for the link but i have to bind the data without any occurence of event.I hope you understand what i am sayingin the example it is given that when we click on a row a particular event is generated and within that event the details view data is bound.
subodh