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

RadSiteMap Does not show parent node and lines

1 Answer 106 Views
SiteMap
This is a migrated thread and some comments may be shown as answers.
Ronak
Top achievements
Rank 1
Ronak asked on 28 Oct 2010, 02:19 PM
Hi there
i am using radsitemap in listview and then bind radsitemap to Listview well it works fine but it doesnt show parent node and therefore nodelines.please refer code below
<ItemTemplate>
                         <li class="staff-item">
                             <div class="photo-container">
                                  <a href='<%# DataBinder.Eval(Container.DataItem,"PageUrl") %>' >
                                     <img src='<%# DataBinder.Eval(Container.DataItem,"Photo") %>' alt="" height="110" width="90"/>
                                  </a>
                             </div>
                             <div class="data-container">
                                  <ul>
                                     <li>
                                        <a href='<%# DataBinder.Eval(Container.DataItem,"PageUrl") %>'>
                                            <%# DataBinder.Eval(Container.DataItem, "Name")%>
                                        </a>
                                     </li>
                                     <li><%# DataBinder.Eval(Container.DataItem, "PrimaryTitle")%></li>
                                     <li>
                                      <!-- <%# DataBinder.Eval(Container.DataItem, "Area")%> -->
                                        <Telerik:RadSiteMap ID="radSiteMap" DataSource='<%#DataBinder.Eval(Container.DataItem, "Areas") %>'  DataFieldID="ID" DataFieldParentID="ParentID"
                                                          DataTextField="AreaText" ShowNodeLines="true" runat="server" >
                                                                                             
                                      </Telerik:RadSiteMap>
                                    </li>
                                  </ul>
                             </div>
 
                         </li>  
                    </ItemTemplate>
public class FacultyStaff {
 
       public string ID { get; set; }
       public string Name { get; set; }
       public string Photo { get; set; }
       public string PrimaryTitle { get; set; }
       public string PageUrl { get; set; }
       public List<FacultyArea> Areas { get; set; }
       public string Area { get; set; }
   }
   public class FacultyArea {
 
       public string ID { get; set; }
       public string AreaText { get; set; }
       public string ParentID { get; set; }
   }
if (item["AreaDirectory"] != null)  {
                  /*Code to get only first area of Speciality
                  string[] Areas = item["AreaDirectory"].ToString().Split(new char[] { ';' });
                  string[] Area = Areas[0].Split(new char[] { '|' });
                  faculty.Area = Area[0]; */
 
                  /*Code To Display all areas in Telerik SiteMap Control */
                  List<FacultyArea> facultyareas = new List<FacultyArea>();
                  TaxonomyFieldValueCollection areas = (TaxonomyFieldValueCollection)item["AreaDirectory"];
                  foreach (TaxonomyFieldValue area in areas) {
                      FacultyArea facultyarea = new FacultyArea();
                      facultyarea.AreaText = area.Label;
                      facultyarea.ID = area.TermGuid;
                      facultyarea.ParentID = "46355449-ACD0-412C-A80F-9C91872B2EA0";
                      facultyareas.Add(facultyarea);
                       
                  }
                  FacultyArea parentAreas = new FacultyArea() { ID = "46355449-ACD0-412C-A80F-9C91872B2EA0", ParentID = "D59B0E15-8207-439F-8034-841887AF53D8", AreaText = "Special Areas" };
                  facultyareas.Add(parentAreas);
                  faculty.Areas = facultyareas;
                   
                }

Please advise me
Thanks
Ronak

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 03 Nov 2010, 09:17 AM
Hi Ronak,

Please check again our help article about databinding of RadSiteMap here - note that ParentID should be set to null in order to have parent node.

Hope this helps.

Kind regards,
Yana
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
SiteMap
Asked by
Ronak
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or