convert a datatable or list<objects> into gridview

I have a datatable with 3 fields state, carrier and rate. I have to display it in a gridview such that y-axis will be state and x-axis will be carrier and the corresponding cell display the rate.
datatable structure
state carrier rate
NB     hunt   1.0
NB     atl       .23
NX     hunt   2.5
NX     atl       .45

gridview should be
         hunt   atl
NB    1.0     .23
NX    2.5     .45
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Asim NazirCommented:
You need to convert rows into column. You can do using Pivot. Details here:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pratima PharandeCommented:
You can pivote the datatable and create new datatable as per your requiremnt

refer the below link
which provides step by step details of how to do it and assign to grid
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.