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

overwritte datasource

1 Answer 54 Views
SiteMap
This is a migrated thread and some comments may be shown as answers.
Daniela
Top achievements
Rank 1
Daniela asked on 16 Sep 2011, 11:13 AM
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

1 Answer, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 20 Sep 2011, 11:56 AM
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
Tags
SiteMap
Asked by
Daniela
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Share this question
or