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

Rotating Columns

9 Answers 228 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jon Bergquist
Top achievements
Rank 1
Jon Bergquist asked on 12 Feb 2009, 08:55 PM
Hi - is it possible to rotate our columns and rows when we databind a list object to the grid?  Basically, we are attempting to rotate our data so that the columns become rows and rows become columns.

Thanks

Jon

9 Answers, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 16 Feb 2009, 01:52 PM
Hi Jon,

Currently the grid does not support this functionality. The only way to achieve this is to transform your data source. I have prepared an example solution that shows how to achieve this for any .NET collection (IEnumerable<T>). Hope you will find it useful.

Regards,
Stefan Dobrev
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.
0
Jon Bergquist
Top achievements
Rank 1
answered on 17 Feb 2009, 07:26 PM
That is some fancy code.  I don't quite follow it but it does do the trick.  One more thing - is it possible to label the side bars?  What I'm looking to do is rotate the columns but also l would like to label the sides - similar to what you would see in a spreadsheet.  I have a screenshot of a mockup but I don't think attachments can be uploaded in your site.

Thanks
0
Jon Bergquist
Top achievements
Rank 1
answered on 18 Feb 2009, 08:29 PM
Here is a link to a screenshot of what I was referring to in the previous post. 


Link to screenshot
0
Milan
Telerik team
answered on 20 Feb 2009, 10:15 AM
Hello Jon Bergquist,

The only way to create something similar to a spreadsheet labeling is to define an unbound column with a custom cell style. I'm sending you a sample project that demonstrates that.
I've created a custom cell style that host a TextBox which is bound to the cell's data context and uses a converter to determine that label should be applied to each row.
Hope this works.

Greetings,
Milan
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.
0
Jon Bergquist
Top achievements
Rank 1
answered on 20 Feb 2009, 11:14 PM
Thank you for that.  In the ConvertToList method I would like to conditionally prevent objects from getting loaded in the list.  I can't seem to access the transposed fields though.  Is this possible?

 
0
Jordan
Telerik team
answered on 24 Feb 2009, 10:10 AM
Hello Jon Bergquist,

You can define a where clause to filter the transposed result. Look at line 5.

public Page() 
    InitializeComponent(); 
 
    Func<objectbool> whereClause = (obj) => obj.GetType().GetProperty("Customer 1").GetValue(obj, null).Equals(1); 
 
    IList<Customer> customers = Customer.GetAll(); 
    IEnumerable transposed = customers.Transpose(); 
    TranspodedCustomersList = ConvertToList(transposed).Where(whereClause).ToList(); 
 
 
    GridView.ItemsSource = customers; 
    GridViewTransposed.ItemsSource = new ProxyEnumerable(TranspodedCustomersList); 

All the best,
Jordan
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.
0
Le_Roy
Top achievements
Rank 2
answered on 08 Apr 2010, 10:49 AM
Hello. Got some troubles.
I was trying to transpond data received from asmx web service.
It doesn't works. Data is shown somehow weird %)
Screenshot attached.
Hope for your help. Tx.

I'll try to post code, a little bit later.

UPDATE: Found my mistake. Tx alot!
0
Manish Kumar
Top achievements
Rank 1
answered on 28 Sep 2010, 03:00 PM
Hi there,

 I am facing similar problem while rendering Rad gridview with the transposed data. for reference i have attached the image of the screenshot. I want to show data in gridview where column acts as Horizontal and rows are shown vertically

Thanks... problem identified...

thanks
Manish Kumar
0
Vlad
Telerik team
answered on 28 Sep 2010, 03:04 PM
Hi,

 You can use the approach demonstrated in this blog post

Sincerely yours,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Jon Bergquist
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Jon Bergquist
Top achievements
Rank 1
Milan
Telerik team
Jordan
Telerik team
Le_Roy
Top achievements
Rank 2
Manish Kumar
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or