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
    Apr 09, 2013 @ 15:13
    Fuji Kusaka
    0

    Creating a Dynamic Glossary Content

    Hi Guys,

    Can someone give me a hint here on creating a Glossary Content. What am planning on doing is having a folder under my Content Section under which i will have a list of nodes from A-Z.

    Each content (a-z) will have a there RTE, from there the default page will display the main content A, then from the navigation (A-Z) if either B is clicked only the content of B will be displayed just like you would do with a Query String for paging but here i can figure out how to do this.

    So when i click on either one of the links 
    www.mypage.com/questions.aspx?page=A or B 

    Any Idea? 

    fuji

  • Fuji Kusaka 2203 posts 4220 karma points
    Apr 09, 2013 @ 22:09
    Fuji Kusaka
    0

    Got it working somehowm, here is how my code looks like if someday someone needs to do something similar and if this can be improved please do so

     var newsItems = Model.NodeById(1177);
                 var sortedItems = newsItems.Children.Where("Visible").OrderBy("Name, Ascending");       
                           
                    foreach(dynamic p in sortedItems){
                        var t = @Model.NodeById(p.Id);
                        string select = (@t.Id == @p.Id)? "selected": "";
                    <div style="float:left; padding:0 3px;"><a href="[email protected]" class="@select">@p.Name</a></div>
                    }
                               
           
                    if (!string.IsNullOrEmpty(Request.QueryString["glossary"])){
                        var query = Request.QueryString["glossary"];
                        var c = @Model.NodeById(query);
                        <br/><p>@c.glossaryContent</p>
                    }
                    else{
                        @newsItems.Children.First().glossaryContent
                    }
  • Fuji Kusaka 2203 posts 4220 karma points
    Apr 10, 2013 @ 08:05
    Fuji Kusaka
    0

    Just noticed that the my class"Selected" is not properly used here. Instead class will be applied on each items since they all will have the same Id as per 

    stringselect=(@t.Id==@p.Id)?"selected":"";

    Making a Onclick event here wont work either since the page reloads. 

    Anyone has an idea how i can get this working?

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Apr 10, 2013 @ 11:42
    Fuji Kusaka
    100

    Here is the final code with the active Link set 

     

     var newsItems = Model.NodeById(1177);
        var alpha = Request.QueryString["glossary"];
    int Id = Convert.ToInt32(alpha);
    var sortedItems = newsItems.Children.Where("Visible").OrderBy("Name, Ascending");
    var totalNodes = sortedItems.Count();
    int page = 0;
    foreach(dynamic p in sortedItems){
    string select = (p.Id == Id)? "selected": " ";
    <div style="float:left; margin:0 5px 0 0;"><a href="[email protected]" class="@select">@p.Name</a></div>}
    if (!string.IsNullOrEmpty(Request.QueryString["glossary"])){
    var c = @Model.NodeById(alpha);
    if(c.HasValue("glossaryContent")){
    <br/><br/><div class="sdf">@c.glossaryContent</div>}
    else{
    <br/><br/><div class="sdf">Nothing Yet</div>
    }

    else{
    <br/><br/><div class="sdf">@newsItems.Children.First().glossaryContent </div>
    }

     

Please Sign in or register to post replies

Write your reply to:

Draft