overwritte datasource

2 posts, 0 answers
  1. Daniela
    Daniela avatar
    12 posts
    Member since:
    Aug 2010

    Posted 16 Sep 2011 Link to this post

    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
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 20 Sep 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top