Avinash Maddy

Avinash Maddy

  • 1.6k
  • 66
  • 1.9k

How to convert Gridview Rows to Columns and Columns to Rows

Jun 11 2013 10:50 AM

HI All,

I need display  columns as rows androws as columns in gridview like

 EX:I have a stored procedure like(select center,dept,sum(Amount) from table where distno=19);(note:I am selecting those columns from multiple tables using joins) wrote that single query for understanding.....

so when i bind it dynamically the gridview looks

centre dept amount

hyd     IT      2500

hyd   cse      2600

hyd  ECE     2700

bangl IT     2200

bangl CSE  2300

bang  ECE 2500    ----like so on......as i have some  no of centers and dept(based on selected distrtict center and dept varies)

I want to bind gridview like

centre  IT CSE ECE

hyd    2500 2600 2700

bang   2700 2200 2300

...

How can i achieve this??(hope the question is understandable)

Thanks..


Answers (3)