Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > SiteMap > overwritte datasource

Not answered overwritte datasource

Feed from this thread
  • Daniela avatar

    Posted on Sep 16, 2011 (permalink)

    When using more than one RadSiteMap on the page the data source is overwritten.

      <telerik:RadSiteMap runat="server" ID="RadSiteMapCategoryPath" OnNodeDataBound="OnNodeDataBound_CategoryPath" MaxDataBindDepth="1">
      <LevelSettings>
        <telerik:SiteMapLevelSetting Level="0" Layout="Flow" SeparatorText="--">
          <ListLayout />
        </telerik:SiteMapLevelSetting>
      </LevelSettings>
    </telerik:RadSiteMap>
    <telerik:RadSiteMap runat="server" ID="RadSiteMapCategoryOwerview" OnNodeDataBound="OnNodeDataBound_CategoryOwerview" MaxDataBindDepth="1">
      <LevelSettings>
        <telerik:SiteMapLevelSetting Level="0">
          <ListLayout RepeatColumns="3" AlignRows="true" />
        </telerik:SiteMapLevelSetting>
      </LevelSettings>
    </telerik:RadSiteMap>

    Code:
          var cats1 = new List<Categories>();
          this.ModifyWorkflowControlReadOnly(a =>
          {
            cats1 = Categories.GetAll(a);
          });
      
          RadSiteMapCategoryOwerview.DataTextField = "Name";
          RadSiteMapCategoryOwerview.DataValueField = "ID";
          RadSiteMapCategoryOwerview.DataFieldID = "ID";
          RadSiteMapCategoryOwerview.DataFieldParentID = "ID_Category_Parent";
          RadSiteMapCategoryOwerview.DataSource = cats1;
      
          RadSiteMapCategoryOwerview.DataBind();
      
    -------------------
      
          var cats2 = new List<Categories>();
          this.ModifyWorkflowControlReadOnly(a =>
          {
            cats2 = Categories.GetAll(a);
          });
      
          RadSiteMapCategoryPath.Dispose();
      
          // add start item
          Categories item = new Categories();
          item.Name = "Hautkategorien";
          cats2.Add(item);
      
          RadSiteMapCategoryPath.DataTextField = "Name";
          RadSiteMapCategoryPath.DataValueField = "ID";
          RadSiteMapCategoryPath.DataFieldID = "ID";
          RadSiteMapCategoryPath.DataFieldParentID = "ID_Category_Parent";
          RadSiteMapCategoryPath.DataSource = cats2;
      
          RadSiteMapCategoryPath.DataBind();

    The site map RadSiteMapCategoryPath and RadSiteMapCategoryOwerview show the same result.
    But the List cats1 and cats2 have different values.

    How can I solve this problem?

    Best regards
    Daniela

    Reply

  • Genady Sergeev Genady Sergeev admin's avatar

    Posted on Sep 20, 2011 (permalink)

    Hello Daniela,

    As far as I can see both RadSiteMaps are bound against Categories.GetAllData(). How is that returning different values each time? I suggest that you double check that Categories.GetAllData is returning different lists, otherwise the SiteMaps would display the same by presumption.

    All the best,
    Genady Sergeev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > SiteMap > overwritte datasource