|
Rank: Newbie Groups: Member
Joined: 11/4/2010 Posts: 6
|
I have a page that uses asp:treeview and sitemapdatasource and it works fine. I changed the asp treeview to eo:treeview and uses the same sitemapdatasource. Now it is saying the datasource control for the eo:treeview does not exist. I scanned the EO Help documents and support forum and could not find any help on this. Any clues/sample working codes? many thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Make sure your data source control and the TreeView control are in the same naming container. This usually means to put them inside the same coding unit. For example, they will work if they both are in your master page, or both are inside the same content page. But it won't work if you have one inside the master page and the other inside a content page.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 11/4/2010 Posts: 6
|
Thanks for the prompt response.
The data source control and the treeview control are both in the same .aspx file. One inside of an updatepanel and one outside. I moved the sitemapdatasource into the same updatepanel with the eo:treeview (which I did not have to do with the asp:treeview). Now it seems to be able to find the data source control, but is complaining "Could not find the sitemap node with URL 'ABC'" since I specified "StartingNodeUrl="ABC" in the sitemapdatasource control. But 'ABC' is right there in the web.sitemap file...
This is all very confusing. Where can I find the detailed APIs for these objects?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Moving it outside of UpdatePanel makes sense. Both controls must be inside the same naming container. UpdatePanel starts its own naming container.
"Could not find the sitemap node with URL 'ABC'" does not have anything to do with us. That error usually occurs when the Url you specified does not exist in your site map. Since you said it does exist, we do not know what caused it either. In any case, that error is thrown by the SiteMapDataSource control. So you will want to search SiteMapDataSource documentation or online to get more information on that error.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 11/4/2010 Posts: 6
|
Actually This is all I have in the web.sitemap file: web.sitemap: <?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode url="ABC" title="ABC"> <siteMapNode url="http://www.yahoo.com" title="Adequacy" roles="outcomesUser, administrators"/> </siteMapNode>
</siteMap>
And this is the .aspx file:
demo.aspx:
<%@ Register TagPrefix="eo" NameSpace="EO.Web" Assembly="EO.Web" %> <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Demo.aspx.cs" Inherits="Demos_TreeView_Features_Populate_On_Demand_Demo" Title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="demo" Runat="Server"> <p> EO.Web TreeView supports populate on demand. Populate on demand is useful when the full content of the TreeView is too large to be all loaded up front. </p> <p> To enable populate on demand, set the TreeNode's <span class="highlight">PopulateOnDemand</span> to true and handles the TreeView's <span class="highlight">ItemPopulate</span> event. </p> <p> The following TreeView use this feature to populate sub nodes when a parent node is clicked. </p> <asp:SiteMapDataSource runat="server" ID="ReportsSiteMap" ShowStartingNode="false" StartFromCurrentNode="false" StartingNodeUrl="ABC"/> <eo:TreeView runat="server" id="TreeView1" AutoSelect="ItemClick" ControlSkinID="None" Width="250px" Height="280px" OnItemPopulate="TreeView1_ItemPopulate" DataSourceID="ReportsSiteMap"> <TopGroup Style-CssText="border-bottom-color:#999999;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#999999;border-left-style:solid;border-left-width:1px;border-right-color:#999999;border-right-style:solid;border-right-width:1px;border-top-color:#999999;border-top-style:solid;border-top-width:1px;color:black;cursor:hand;font-family:Tahoma;font-size:8pt;padding-bottom:2px;padding-left:2px;padding-right:2px;padding-top:2px;"> <Nodes> <eo:TreeNode PopulateOnDemand="True" Text="Demo Files"></eo:TreeNode> </Nodes> </TopGroup> <LookNodes> <eo:TreeNode ImageUrl="00030203" DisabledStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;color:Gray;padding-bottom:1px;padding-left:1px;padding-right:1px;padding-top:1px;" CollapsedImageUrl="00030301" ItemID="_Default" NormalStyle-CssText="PADDING-RIGHT: 1px; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; COLOR: black; BORDER-TOP-STYLE: none; PADDING-TOP: 1px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: transparent; BORDER-BOTTOM-STYLE: none" ExpandedImageUrl="00030302" SelectedStyle-CssText="background-color:#316ac5;border-bottom-color:#999999;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#999999;border-left-style:solid;border-left-width:1px;border-right-color:#999999;border-right-style:solid;border-right-width:1px;border-top-color:#999999;border-top-style:solid;border-top-width:1px;color:White;padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px;"></eo:TreeNode> </LookNodes> </eo:TreeView> </asp:Content>
And this is the codebehind file(it's from the demo files. I did not change it) demo.aspx.cs
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO;
public partial class Demos_TreeView_Features_Populate_On_Demand_Demo : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {
}
protected void TreeView1_ItemPopulate(object sender, EO.Web.NavigationItemEventArgs e) { //Get the parent node EO.Web.TreeNode parentNode = (EO.Web.TreeNode)e.NavigationItem;
//Get the root path string parentDir = Server.MapPath("~/Demos");
//Combine the root path with the node's Value property, //in which we stores the relative path to the root if (parentNode.Value == null) parentNode.Value = string.Empty; parentDir = Path.Combine(parentDir, parentNode.Value);
//Find all the directories string[] dirs = Directory.GetDirectories(parentDir); foreach (string dir in dirs) { string dirName = Path.GetFileName(dir); EO.Web.TreeNode dirNode = new EO.Web.TreeNode(dirName);
//Directories can have child items. So at here we //store the path associated with this directory to //its Value property and set PopulateOnDemand to true dirNode.Value = Path.Combine(parentNode.Value, dir); dirNode.PopulateOnDemand = true;
parentNode.SubGroup.Nodes.Add(dirNode); }
//Find all files string[] files = Directory.GetFiles(parentDir); foreach (string file in files) { string fileName = Path.GetFileName(file); EO.Web.TreeNode fileNode = new EO.Web.TreeNode(fileName); fileNode.NavigateUrl = "http://renaladvantage.com"; parentNode.SubGroup.Nodes.Add(fileNode); } } }
If you can review it and let me know where I have done wrong, I would high appreciate it. Thanks a lot!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
No, we do not do that. We generally do not review or troubleshoot user code, especially when the error originates on the SiteMapDataSource control which is from MS, not us. You can run into that issue with or with out our product. We will be more than happy to help if you have any specific question or issue that is directly related to our product.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 11/4/2010 Posts: 6
|
I don't understand how you can be so sure that this is a bug of the sitemapdatasource control. Obviously it works with the asp:treeview control but not your eo:treeview control. My specific question is - how do I make eo:treeview control work with sitemapdatasource? Or are you saying it does not work? Can you show me a working sample then?
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We call SiteMapDataSource the same way as ASP.NET TreeView does. The only difference is how we look for the SiteMapDataSource control (we only look inside the same naming container). So if you are getting this error with our TreeView, then you should also get this error ASP.NET TreeView. StartingNodeUrl is transparent to us, so our control does not even care what you set that property to. We basically ask the SiteMapDataSource to give us a list of nodes, if SiteMapDataSource is happy with how it is configured, we get the nodes. If it is not, it throws and everyone blows up. I can't see any reason why SiteMapDataSource is happy with ASP.NET TreeView but not happy with us.
If you believe this has anything to do with our product, try to reproduce the problem in a blank project and clearly demonstrate that ASP.NET TreeView works and our TreeView doesn’t. Once we have that we will look into it and see what we can find. Before that there is really nothing else we can tell you because we are not aware anything that can cause ASP.NET TreeView to work fine but ours causing that error.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 11/4/2010 Posts: 6
|
Well I started out on a blank project and the eo:treeview actually worked. I am still not sure why it didn't work yesterday but I am glad you pointed out the option to test. I still have to figure out how to work this control into our current project but at least I see the light at the end of the tunnel.
I still would like to see a working sample in the demos shipped with the product so I would not have to spend so much time trying to figure out whether this works or not. Enough discussions there already. So thanks for the help.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Glad to see that it works for you and thank you very much for the update!
We did not include a sample for the SiteMapDataSource in our sample project because there is nothing special about it ---- it should just work. In fact the previous code you posted works fine as well. However I do understand where you come from so we will see what we can do. Having a sample at least can demonstrate that is supported.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 11/4/2010 Posts: 6
|
Besides being such a great help and such a nice person, you are unbelievably smart too - even know where I come from. On the contrary, I can only remotely guess where you come from. I am so glad there are smart ones like you out there to help out people like myself... Thanks a lot and have a great day
|
|