Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello every one...

I have a gridview in which i am showing taxes added on goods in invoice.

so in database i have tax table in which i have 'taxid' and 'taxname'.

so suppose for invoice no 1 there are two taxes VAT and Service.

so i want to show that taxes names in gridview which i will get from tax table..

Problem is that gridview only takes database column names while binding.

so how can i show one column with two different values..??

i.e.

I want like this

Invoiceno | tax1id | tax1name | tax2id | tax2name
------------------------------------------------------
1 2 VAT 3 SERVICE

2 1 Sales 2 VAT


and i m geting

Invoiceno | tax1id | tax1name | tax2id | tax2name
------------------------------------------------------
1 2 VAT 3 VAT

2 1 Sales 2 Sales



Thanks n regards
Rohit.
Posted
Comments
AshishChaudha 14-Aug-12 5:25am    
share with us what you have done???

1 solution

The thing is that your table structure itself is wrong. You should normalize the table.

Let's consider that tax items on your goods get increased, in that case, you may have to add another column like tax2id and tax3name.

Rather I'd suggest you to normalize the table structure.
Use table structure like

VB
InvoiceNo | TaxId | TaxName
------------------------------
1 2 VAT 
1 3 SERVICE
2 1 Sales 
2 2 VAT


And while retrieving the data, you can have something called 'Group By' clause.
 
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