To DataGrid or not to DataGrid?

  • Thread starter Thread starter Ted Stewart
  • Start date Start date
T

Ted Stewart

I don't know much about DataGrids, and while I am looking for an
excuse to learn how to use them, I'd like to be sure that what I'm
trying to do is possible before I doom myself to failure.

I have a DataTable retrieved from a database which consists of a
variable number of columns but only one row. All the data will be
strings. If I bind this into a DataGrid without changing the style of
the grid, I get the following:
FirstName LastName Language
Ted Stewart English

I'd like to stack the data vertically as a list of labels and
textboxes, so they'd resemble the following:
FirstName Ted
LastName Stewart
Language English

Is this something that is feasible for a DataGrid, or would I do
better to generate the labels and textboxes dynamically within a
groupbox?
 
If there will always be only one single row then a grid might be a bit much.
Depends on what your PM says the GUI's supposed to all look like together, I
guess.

Have you looked into using a PIVOT clause in your SQL? Then the
transformation is done at the data end not the GUI end. Depends on what you
want to do with the data besides just displaying it but it's a good clause
have in your bag.

Do a google using: "pivot" "SQL" and the database product that you use.

Hope that helps a bit.

Robert Smith
Kirkland, WA
www.smithvoice.com
 
Back
Top