GroupBy Alphabet

4 posts, 0 answers
  1. Phill Hodgkinson
    Phill Hodgkinson avatar
    35 posts
    Member since:
    Nov 2004

    Posted 06 Jul 2009 Link to this post

    Hi There,

    I'm wondering if anyone has attempted this before and can possibly point me in the right direction. I have a rather long list of company names and would like to be able to group them alphabetically, with the letter of the alphabet being the title for the group. So it would look something like:
    A
    ABC Company
    Apple Company
    B
    BCD Company
    Banana Company

    Any ideas? I assume this would be a Custom GroupByExpression but I have very limited experience with the Telerik Grid (this is for a SItefinity project that uses the grid). Any help would be greatly appreciated!

    Cheers,
    Phill
  2. Phill Hodgkinson
    Phill Hodgkinson avatar
    35 posts
    Member since:
    Nov 2004

    Posted 08 Jul 2009 Link to this post

    Hi there,
    So I've made a bit of progress by adding Select *, left(Name,1) AS GroupLetter from Table to my SQL statement and can use GroupLetter as my GroupByField. The trouble I'm having is that I don't want to have any text with the letter other than the letter itself. All Grouping examples have something like "Total: #"  or "Country: Canada"  I don't want to have any text and/or character before the Letter. Is there a way to do this? If I don't define the text it displays "GroupLetter: A" as a default instead.

    Thanks again for any help.
    Cheers,
    Phill
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 09 Jul 2009 Link to this post

    Hello Phill,

    Indeed, having a separate field from the datasource, for the first letters, and then using this field to group on, is the most straightforward approach in this case. This ensures that the functionality is handled automatically, at the database level, and avoid complex custom coding.
    Further, you can alter the grouping text, as shown in the following article:

    http://www.telerik.com/help/aspnet-ajax/grdcustomizegridgroupheaderitem.html

    I hope this information helps.

    Sincerely yours,
    Yavor
    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.
  5. Phill Hodgkinson
    Phill Hodgkinson avatar
    35 posts
    Member since:
    Nov 2004

    Posted 09 Jul 2009 Link to this post

    Exactly the link I was looking for! My apologies for not being able to find it on my own!

    Many thanks!
    Phill
Back to Top