how to get the column names from the gridview

P

Pradeep

hi,
im having a very peculiar problem. I populate the gridview based on the
result of a query, and the gridview shows the rows that are returned by
the query.
now if i give gridview1.rows.count i get exactly the no of rows in the
gridview but when i give gridview1.columns.count i always get it as 0
despite columns being present in the gridview. Does anyone know y this
happens ?
Also, i want to get the column names say like age, name, address etc
from the gridview..how can i do this ?? will
gridview1.columns.headertext do the job?? (i being an index
variable)
bye
pradeep
 
C

Cowboy \(Gregory A. Beamer\)

In a DataSet, you have access to rows and columns in the manner you
prescribe. When you paint on the page, the cells/columns (TDs) are inside
the rows (TRs), as items are ultimately "painted:" as HTML tables. Try
looking at the cell collection of the header row.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
 
P

Pradeep

Hello Cowboy,
Thanks for giving the hint...
Gridview1.headerrow.cells.text did the job
Thank u very much...i was pullin my hair from the morning not knowing
how to do this..
thanks again
Bye
Pradeep


In a DataSet, you have access to rows and columns in the manner you
prescribe. When you paint on the page, the cells/columns (TDs) are inside
the rows (TRs), as items are ultimately "painted:" as HTML tables. Try
looking at the cell collection of the header row.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
Pradeep said:
hi,
im having a very peculiar problem. I populate the gridview based on the
result of a query, and the gridview shows the rows that are returned by
the query.
now if i give gridview1.rows.count i get exactly the no of rows in the
gridview but when i give gridview1.columns.count i always get it as 0
despite columns being present in the gridview. Does anyone know y this
happens ?
Also, i want to get the column names say like age, name, address etc
from the gridview..how can i do this ?? will
gridview1.columns.headertext do the job?? (i being an index
variable)
bye
pradeep
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top