468,765 Members | 1,657 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

format data in grid

I'm pulling data out of an oracle db and populating a datagrid such as this

cars doors Cylinders
chevy 4 6
ford 2 8

how can i make it such as

cars chevy ford
cylinder 6 8
doors 4 2

if i can do this in either a datagrid or another way that would work
thx

Nov 18 '05 #1
5 1247
You have to use DataList control instead of DataGrid control
DataList control has a property RepeatDirection that will show your data in
the way you want by setting it to Horizontal

Regards
Martin

"IGotYourDotNet" <IG************@discussions.microsoft.com> wrote in message
news:10**********************************@microsof t.com...
I'm pulling data out of an oracle db and populating a datagrid such as this
cars doors Cylinders
chevy 4 6
ford 2 8

how can i make it such as

cars chevy ford
cylinder 6 8
doors 4 2

if i can do this in either a datagrid or another way that would work
thx

Nov 18 '05 #2
Hey,

if you find a solution, please make sure it is posted here, I am looking for
the exact same thing!

thanks,

--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com
"IGotYourDotNet" <IG************@discussions.microsoft.com> wrote in message
news:3A**********************************@microsof t.com...
i tried that and it still only displays as
cars doors Cylinders
chevy 4 6
ford 2 8

i found an article once on how to change the header of the grid from the top to the side but i can't find it again. If i could find that that would work on what i need
"Martin Marinov" wrote:
You have to use DataList control instead of DataGrid control
DataList control has a property RepeatDirection that will show your data in the way you want by setting it to Horizontal

Regards
Martin

"IGotYourDotNet" <IG************@discussions.microsoft.com> wrote in message news:10**********************************@microsof t.com...
I'm pulling data out of an oracle db and populating a datagrid such as

this

cars doors Cylinders
chevy 4 6
ford 2 8

how can i make it such as

cars chevy ford
cylinder 6 8
doors 4 2

if i can do this in either a datagrid or another way that would work
thx


Nov 18 '05 #3
It must do that. Take a look at the microsoft article :
http://msdn.microsoft.com/library/de...ctiontopic.asp

Regards
Martin

"IGotYourDotNet" <IG************@discussions.microsoft.com> wrote in message
news:3A**********************************@microsof t.com...
i tried that and it still only displays as
cars doors Cylinders
chevy 4 6
ford 2 8

i found an article once on how to change the header of the grid from the top to the side but i can't find it again. If i could find that that would work on what i need
"Martin Marinov" wrote:
You have to use DataList control instead of DataGrid control
DataList control has a property RepeatDirection that will show your data in the way you want by setting it to Horizontal

Regards
Martin

"IGotYourDotNet" <IG************@discussions.microsoft.com> wrote in message news:10**********************************@microsof t.com...
I'm pulling data out of an oracle db and populating a datagrid such as

this

cars doors Cylinders
chevy 4 6
ford 2 8

how can i make it such as

cars chevy ford
cylinder 6 8
doors 4 2

if i can do this in either a datagrid or another way that would work
thx


Nov 18 '05 #4
I don't think this is what we're looking for, or is it.... Lemme see if I can clear this up a little. This is how a DataGrid displays a table's data now:

ID UserName Password Security
1 David dave 10 Edit
2 John doe 10 Edit
3 Mary smith 5 Edit

Correct me if i'm wrong, but we are looking for the datagrid to do the following:

ID 1 2 3
Username David John Mary
Password dave doe smith
Security 10 10 5
Edit Edit Edit
Actually, its like a Pivot table? Maybe have a stored procedure handle the returning values as a pivot table? Would it still be editable?

THANKS!
--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com
"Martin Marinov" <me********@mecrossroad.bg> wrote in message news:ON**************@TK2MSFTNGP09.phx.gbl...
It must do that. Take a look at the microsoft article :
http://msdn.microsoft.com/library/de...ctiontopic.asp

Regards
Martin

"IGotYourDotNet" <IG************@discussions.microsoft.com> wrote in message
news:3A**********************************@microsof t.com...
i tried that and it still only displays as
cars doors Cylinders
chevy 4 6
ford 2 8

i found an article once on how to change the header of the grid from the

top
to the side but i can't find it again. If i could find that that would

work
on what i need
"Martin Marinov" wrote:
You have to use DataList control instead of DataGrid control
DataList control has a property RepeatDirection that will show your data in the way you want by setting it to Horizontal

Regards
Martin

"IGotYourDotNet" <IG************@discussions.microsoft.com> wrote in message news:10**********************************@microsof t.com...
> I'm pulling data out of an oracle db and populating a datagrid such as
this
>
> cars doors Cylinders
> chevy 4 6
> ford 2 8
>
> how can i make it such as
>
> cars chevy ford
> cylinder 6 8
> doors 4 2
>
> if i can do this in either a datagrid or another way that would work
> thx
>


Nov 18 '05 #5
ok, i've got your point and found a previous code that i wrote for inverting
rows and columns

DataTable dt = (DataTable) dataGrid1.DataSource;
DataTable dt_dest = new DataTable();

dt_dest.Columns.Add ( dt.Columns[0].ColumnName );
for ( int i=0; i < dt.Rows.Count; i++ )
{
dt_dest.Columns.Add ( dt.Rows[i][0].ToString() );
}

for ( int i=1; i < dt.Columns.Count; i++ )
{
DataRow dr = dt_dest.NewRow();
dr[0] = dt.Columns[i].ColumnName;
for ( int r=0; r < dt.Rows.Count; r++ )
{
dr[r+1] = dt.Rows[r][i];
}
dt_dest.Rows.Add ( dr );
}

DataList.DataSource = dt_dest;

Hope This Helps
Regards
Martin

"David Lozzi" <dlozzi(remove-this)@delphi-ts.com> wrote in message
news:eG**************@TK2MSFTNGP12.phx.gbl...
I don't think this is what we're looking for, or is it.... Lemme see if I
can clear this up a little. This is how a DataGrid displays a table's data
now:

ID UserName Password Security
1 David dave 10 Edit
2 John doe 10 Edit
3 Mary smith 5 Edit

Correct me if i'm wrong, but we are looking for the datagrid to do the
following:

ID 1 2 3
Username David John Mary
Password dave doe smith
Security 10 10 5
Edit Edit Edit
Actually, its like a Pivot table? Maybe have a stored procedure handle the
returning values as a pivot table? Would it still be editable?

THANKS!
--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com
"Martin Marinov" <me********@mecrossroad.bg> wrote in message
news:ON**************@TK2MSFTNGP09.phx.gbl...
It must do that. Take a look at the microsoft article :
http://msdn.microsoft.com/library/de...ctiontopic.asp
Regards
Martin

"IGotYourDotNet" <IG************@discussions.microsoft.com> wrote in message news:3A**********************************@microsof t.com...
i tried that and it still only displays as
cars doors Cylinders
chevy 4 6
ford 2 8

i found an article once on how to change the header of the grid from the top
to the side but i can't find it again. If i could find that that would

work
on what i need
"Martin Marinov" wrote:
You have to use DataList control instead of DataGrid control
DataList control has a property RepeatDirection that will show your data in
the way you want by setting it to Horizontal

Regards
Martin

"IGotYourDotNet" <IG************@discussions.microsoft.com> wrote in message news:10**********************************@microsof t.com...
> I'm pulling data out of an oracle db and populating a datagrid such

as this
>
> cars doors Cylinders
> chevy 4 6
> ford 2 8
>
> how can i make it such as
>
> cars chevy ford
> cylinder 6 8
> doors 4 2
>
> if i can do this in either a datagrid or another way that would work
> thx
>


Nov 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Peter | last post: by
15 posts views Thread by Fritz Switzer | last post: by
2 posts views Thread by Peter | last post: by
1 post views Thread by Peter | last post: by
6 posts views Thread by Hutty | last post: by
1 post views Thread by Parveen | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.