Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fuji Kusaka 2203 posts 4220 karma points
    Nov 15, 2013 @ 14:02
    Fuji Kusaka
    0

    Member Tree Nodes

    Hi all,

    Am working on an Intranet system and i would like to know how to display the Members Section Tree Node thats from "a-z". 

    I did get all the members Name from the whole section but here i want to display the alphabetic folder it resides.

    @using System.Linq
    @using System.Xml
    @using umbraco.cms.presentation.Trees
    @{ foreach(Member item in members){ if(item.HasProperty("userFirstName") && item.getProperty("userFirstName").Value.ToString() != String.Empty){ @item @item.Text<br/> } } }
  • Fuji Kusaka 2203 posts 4220 karma points
    Nov 15, 2013 @ 17:46
    Fuji Kusaka
    0

    Any thoughts on this ?

  • Mike Chambers 621 posts 1203 karma points c-trib
    Nov 19, 2013 @ 10:38
    Mike Chambers
    0

    http://stackoverflow.com/questions/18282335/linq-razor-script-to-an-a-z-index

    few suggestions here.. depending on if you want to show empty letters... or just those in use. :-)

  • Fuji Kusaka 2203 posts 4220 karma points
    Nov 20, 2013 @ 06:56
    Fuji Kusaka
    0

    Hi Mike,

    Thanks for the url and response. Yes indeed i did try something very similar but then didnt have time to finish working on it.

    So far this is what i did

      string alpha = "ABCDEFGHIJKLMNOPQRSTUVQXYZ";        
                for(int i= 0; i < 26; i++){
                 @alpha[i]               
          }
  • Fuji Kusaka 2203 posts 4220 karma points
    Nov 21, 2013 @ 08:52
    Fuji Kusaka
    100

    Got this working. Here is the solution if someone have some issues someday.

    var q = Request.QueryString["letter"];
            var members = Member.GetAll;       
            string alpha = "ABCDEFGHIJKLMNOPQRSTUVQXYZ";
          
                <ul>
                   @for (int i = 0; i < 26; i++){                       
                        <a href="?letter=@alpha[i]">@alpha[i]</a>
                     }
               </ul>
                           
                if (!String.IsNullOrEmpty(Request.QueryString["letter"]))
                {
                    foreach (Member a in members.Where(x => x.Text.StartsWith(q, StringComparison.OrdinalIgnoreCase)).Where(y=>y.HasProperty("userFirstName") && y.getProperty("userFirstName").Value.ToString() != String.Empty).OrderBy(x=>x.getProperty("userFirstName").Value.ToString())){
                           @a.getProperty("userFirstName").Value.ToString() @a<br />
                           
                    }
                }
                else{
                    foreach(Member a in members.Where(z=>z.HasProperty("userFirstName") && z.getProperty("userFirstName").Value.ToString() != String.Empty).OrderByDescending(x=>x.CreateDateTime)){
                        @a.Text @a<br />
                    }
                   
                }
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies