Rotating Columns

10 posts, 0 answers
  1. Jon Bergquist
    Jon Bergquist avatar
    47 posts
    Member since:
    Sep 2008

    Posted 12 Feb 2009 Link to this post

    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
  2. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 16 Feb 2009 Link to this post

    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.
  3. DevCraft banner
  4. Jon Bergquist
    Jon Bergquist avatar
    47 posts
    Member since:
    Sep 2008

    Posted 17 Feb 2009 Link to this post

    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
  5. Jon Bergquist
    Jon Bergquist avatar
    47 posts
    Member since:
    Sep 2008

    Posted 18 Feb 2009 Link to this post

    Here is a link to a screenshot of what I was referring to in the previous post. 


    Link to screenshot
  6. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 20 Feb 2009 Link to this post

    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.
  7. Jon Bergquist
    Jon Bergquist avatar
    47 posts
    Member since:
    Sep 2008

    Posted 20 Feb 2009 Link to this post

    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?

     
  8. Jordan
    Admin
    Jordan avatar
    123 posts

    Posted 24 Feb 2009 Link to this post

    Hello Jon Bergquist,

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

    1 public Page() 
    2
    3     InitializeComponent(); 
    4  
    5     Func<objectbool> whereClause = (obj) => obj.GetType().GetProperty("Customer 1").GetValue(obj, null).Equals(1); 
    6  
    7     IList<Customer> customers = Customer.GetAll(); 
    8     IEnumerable transposed = customers.Transpose(); 
    9     TranspodedCustomersList = ConvertToList(transposed).Where(whereClause).ToList(); 
    10  
    11  
    12     GridView.ItemsSource = customers; 
    13     GridViewTransposed.ItemsSource = new ProxyEnumerable(TranspodedCustomersList); 
    14

    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.
  9. Le_Roy
    Le_Roy avatar
    31 posts
    Member since:
    Nov 2009

    Posted 08 Apr 2010 Link to this post

    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!
  10. Manish Kumar
    Manish  Kumar avatar
    62 posts
    Member since:
    Feb 2010

    Posted 28 Sep 2010 Link to this post

    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
  11. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 28 Sep 2010 Link to this post

    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
Back to Top
DevCraft banner