This is a migrated thread and some comments may be shown as answers.

How to rotate column to row?

6 Answers 213 Views
Grid
This is a migrated thread and some comments may be shown as answers.
toi
Top achievements
Rank 1
toi asked on 20 Nov 2008, 07:17 AM
Hi All,


I would like to know is there any way to display data of row to column like.

Original getted data:

           Col1    Col2   Col3
Row1    A         B         C
Row2    V         B         D


The format that I need is:

        Row1    Row2
Col1    A        V
Col2    B        B
Col3    C        D


Is there any sample for solve this problem?

Thanks in advancd,
-Toi

6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 20 Nov 2008, 07:42 AM
Hello toi,

Please check this demo for more info:
http://demos.telerik.com/aspnet/Prometheus/Grid/Examples/Programming/Pivot/DefaultCS.aspx

All the best,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
toi
Top achievements
Rank 1
answered on 20 Nov 2008, 07:59 AM
Thank Vlad,

That's the way I need. :)
0
Roger Abderhalden
Top achievements
Rank 1
answered on 10 Feb 2009, 08:44 AM
Hello

If I understand the code right, it is only possible to display the data as pivot. I will loose the posibility to edit the cell (and store it back to the database automaticaly)? Is this correct?

Kind regards
Roger
0
Sebastian
Telerik team
answered on 10 Feb 2009, 09:46 AM
Hello Roger,

You can implement your custom edit functionality which logically would be on a per column basis. The approach is demonstrated in the projects from the following public forum post:

http://www.telerik.com/community/forums/aspnet/grid/can-i-edit-pivot-data-table.aspx

For your convenience I converted one of the examples to use the latest ASP.NET AJAX version of RadGrid and attached the sample web site to this forum thread.

Best,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Adam Cole
Top achievements
Rank 1
answered on 19 Jul 2009, 04:47 AM
Hello,

For my pivot table, when I click Edit, I want Col1 (e.g. all A's) to be dropdownlists, Col2 (e.g. all B's)  to be datepicker controls, Col3 (e.g. all C's)  to be a textboxes.

      Row1    Row2
Col1    A        A
Col2    B        B
Col3    C        C

I read from another post, that this is not possible to do?   

An alternative solution would be when I click Edit  and my custom edit form "pops up" (by setting the EditMode option to PopUp). 
Using the same code provided in this thread, I am able to make the edit form pop up, but if my pivot table is like the above example, my edit form will pop up too many times - one edit form for each row (A, B, C).    How do I fix this?

Are there any code sample of how to edit a pivot table by using the popup Edit Mode option?

Thanks!
0
Sebastian
Telerik team
answered on 20 Jul 2009, 08:45 AM
Hello Adam,

The first functionality you request (having different column editor types for different rows of pivot table) is not supported since the data type varies on row basis and is the same on a per column basis.

An alternative editing option would be to have built-in popup edit form which hosts template (FormTemplate or WebUserControl custom RadGrid edit form) for editing the items in the vertical grid (see this demo for more details). This edit form will be displayed for each row in the grid.

In case you would like to have a single edit form for all grid fields and display it on click, consider attaching a javascript handler to the onclick attribute of the grid, for example:

<telerik:RadGrid id="RadGrid1" runat="server" onclick="ShowCommonEditForm();" .... />

and utilize RadWindow for this purpose as presented here (having in mind that the window page should contain editors for all grid cells and the approach to refresh the grid can be similar).

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
toi
Top achievements
Rank 1
Answers by
Vlad
Telerik team
toi
Top achievements
Rank 1
Roger Abderhalden
Top achievements
Rank 1
Sebastian
Telerik team
Adam Cole
Top achievements
Rank 1
Share this question
or