DataGrids and obtaining information from them

F

Fred Nelson

I have a stored procedure that returns a one row with large number of
columns (350) to a datagrid "datagrid1" on a web form:

datagrid1.datasource = getcase.getcaseinfo(case#)
datagrid1.databind()

This operation works and it shows the colum name and the value in a table
format.

Once bound I can read the data grid - for example the following code returns
the value in the first column of the first (and only) row:

dim dgitem as DataGridItem = DataGrid1.Items(0)
dim colcnt as integer = dgitem.cells.count
tbxResult.text = "There are " + colcnt + " Colums in the DataGrid "
tbxResult.text += "The value of the first column is: " +
dgitem.cells(0).text.tostring

I would like to obtain the column names and hopefully the data types (eg:
Integer/ Character) for other uses within the program.

For example:
tbxResult += "The first column name is: " + dgitem.cell(0).NAME
tbxResult += "The Data Type is: " + dgitem.cell(0).DATATYPE


Then I would have the Name, Data Type, and value of each item.

Does anyone know a way to do this?

Your help would be greatly appreciated!

Thanks,

Fred
 
C

Cor Ligthert

Hi Fred,

A datagrid is a view from the user on the screen holding the references to
the datasource
A dataview is a view from the computer on the datasource that can be placed
between
A datatable is (mostly) the holder of the references to the real data in
your system.

So when you want information about the used data, I think that you than have
to look at the used datatable in my opinion.

Cor
 

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

Similar Threads


Top