CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 1/11/2008 10:22:36 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 91 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
sunny74
Asp.Net User
problem with menu control and sitemap1/11/2008 10:22:36 AM

0/0

Dear All,

I am using  a menu control in a web app for the first time and I am getting strange kind of error.

For creating and configuring the control on my web page I followed the instructions in this article:

http://msdn2.microsoft.com/en-us/library/16yk5dby(VS.80).aspx

I am using 2 menu controls, the first one displays level 1, level 2 of the sitemap while the second menu displays level 3 onwards.

The error is as follows:

Could not find the sitemap node with URL '~/users.aspx?'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Could not find the sitemap node with URL '~/users.aspx?'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[ArgumentException: Could not find the sitemap node with URL '~/users.aspx?'.]
   System.Web.UI.WebControls.SiteMapDataSource.GetNodes() +548
   System.Web.UI.WebControls.SiteMapDataSource.GetTreeView(String viewPath) +51
   System.Web.UI.WebControls.SiteMapDataSource.GetHierarchicalView(String viewPath) +171
   System.Web.UI.HierarchicalDataSourceControl.System.Web.UI.IHierarchicalDataSource.GetHierarchicalView(String viewPath) +32
   System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData(String viewPath) +74
   System.Web.UI.WebControls.Menu.DataBindItem(MenuItem item) +102
   System.Web.UI.WebControls.Menu.PerformDataBinding() +88
   System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect() +93
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +99
   System.Web.UI.WebControls.Menu.DataBind() +24
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +92
   System.Web.UI.WebControls.Menu.EnsureDataBound() +65
   System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +33
   System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e, Boolean registerScript) +67
   System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e) +49
   System.Web.UI.Control.PreRenderRecursiveInternal() +148
   System.Web.UI.Control.PreRenderRecursiveInternal() +233
   System.Web.UI.Control.PreRenderRecursiveInternal() +233
   System.Web.UI.Control.PreRenderRecursiveInternal() +233
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4437


It can't find the file although it is there.

Although I followed the instructions in the tutorial(link given above) my web.sitemap is different according to my needs. Initially my web.sitemap was as given below:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="~/home.aspx" title="HOME"  description="HOME">
    <siteMapNode title="USERS"  description="USERS" >
      <siteMapNode url="~/users.aspx " title="USERS"  description="USERS HOME"/>
    </siteMapNode>
    <siteMapNode title="MASTERS"  description="MASTER'S HOME" >
      <siteMapNode url="~/mpassword.aspx " title="PASSWORD"  description="PASSWORD" />
      <siteMapNode url="~/bedmaster.aspx " title="BED MASTER"  description="BED MASTER" />
      <siteMapNode url="~/doctormaster.aspx " title="DOCTOR MASTER"  description="DOCTOR MASTER" />
      <siteMapNode url="~/refdoctormaster.aspx " title="REFERRING DOCTOR MASTER"  description="REFERRING DOCTOR MASTER" />
      <siteMapNode url="~/departmentmaster.aspx " title="DEPARTMENT MASTER"  description="DEPARTMENT MASTER" />
      <siteMapNode url="~/opdschmaster.aspx " title="OPD SCHEDULE MASTER"  description="OPD SCHEDULE MASTER" />
      <siteMapNode url="~/clinicmaster.aspx " title="CLINIC MASTER"  description="CLINIC MASTER" />
      <siteMapNode url="~/companymaster.aspx " title="COMPANY MASTER"  description="COMPANY MASTER" />
    </siteMapNode>
    <siteMapNode title="IPD HOME"  description="IPD HOME">
      <siteMapNode url="~/ipdpayment.aspx " title="IPD PAYMENT"  description="IPD PAYMENT" />
      <siteMapNode url="~/ipdlistofpatients.aspx " title="IPD LIST OF PATIENTS"  description="IPD LIST OF PATIENTS" />
      <siteMapNode url="~/hosporderforpharmacy.aspx " title="HOSPITAL ORDER FOR PHARMACY"  description="HOSPITAL ORDER FOR

PHARMACY" />
      <siteMapNode url="~/ipdinfo.aspx " title="IPD INFORMATION"  description="IPD INFORMATION" />
      <siteMapNode url="~/ipddailycashcollection.aspx " title="IPD DAILY CASH COLLECTION"  description="IPD DAILY CASH

COLLECTION" />
      <siteMapNode url="~/ipdbedstatus.aspx " title="IPD BED STATUS"  description="IPD BED STATUS" />
    </siteMapNode>
  </siteMapNode>
</siteMap>

Initially I had written the words node='filename' in the url of every link.Then I deleted it and my sitemap file looked like above.But after that I got the same error with only the node part missing.Then I  changed the sitemap file further and now it is as given below:

<?xml version="1.0" encoding="utf-8" ?>

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >

<siteMapNode url="~/home.aspx" title="HOME" description="HOME">

<siteMapNode title="USERS" description="USERS" >

<siteMapNode url="~/users.aspx " title="USERS" description="USERS HOME"/>

</siteMapNode>

<siteMapNode title="MASTERS" description="MASTER'S HOME" >

<siteMapNode url="~/mpassword.aspx " title="PASSWORD" description="PASSWORD" >

<siteMapNode url="~/passwordchange.aspx " title=" CHANGE PASSWORD" description="PASSWORD" />

</siteMapNode>

<siteMapNode url="~/bedmaster.aspx " title="BED MASTER" description="BED MASTER" >

<siteMapNode url="~/bedprofiles.aspx " title="BED PROFILE" description="BED PFOFILE" />

</siteMapNode>

</siteMapNode>

<siteMapNode title="IPD HOME" description="IPD HOME">

<siteMapNode url="~/ipdpayment.aspx " title="IPD PAYMENT" description="IPD PAYMENT" >

<siteMapNode url="~/paymentmain.aspx " title="PAYMENT" description="PAYMENT" />

</siteMapNode>

</siteMapNode>

</siteMapNode>

</siteMap>

  But the error remains.

A solution to the problem would be gratefully accepted.

Thanks.

stiduck
Asp.Net User
Re: problem with menu control and sitemap1/11/2008 12:51:31 PM

0/0

Hi presume you have tried without the ~/ ?

 

Like: <siteMapNode url="users.aspx " title="USERS"  description="USERS HOME"/>

Instead of: <siteMapNode url="~/users.aspx " title="USERS"  description="USERS HOME"/>

sunny74
Asp.Net User
Re: problem with menu control and sitemap1/11/2008 4:51:12 PM

0/0

Hi,

I followed your suggestion i.e removed ~/ from the URL paths.This resulted in the error NOT being shown.

But I am not getting the desired output.I am getting to see the second level items i.e users,masters,ipd and Home.

Home is level 1 item but it comes at the end of level 2. IF I click on masters link the error resurfaces this time the file name is mpassword.aspx.

I feel this tutorial though a MSDN one is all wrong. Can you suggest a better one?

Thanks.

Amanda Wang - M
Asp.Net User
Re: problem with menu control and sitemap1/14/2008 7:34:22 AM

0/0

Hi,

1.Please check the users.aspx page is in the root directory, "~" represents the root directory. If the path is not corrrect, the error message will be thrown when you compile the application.

Belwo is my test code by refering the MSDN article, during i create this test application, I met the same problem as you can, the cause of the problem is path of the page is not corrent, make the  second sitemapdatasource's StartingNodeUrl as the same as the sitemapnode's, and the check the page can be found by using this path.

Now the below code, works fine on my local machine:

1. the aspx code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Menu_Cases_Cases_twomenu_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1"
            MaximumDynamicDisplayLevels="0" onmenuitemclick="Menu1_MenuItemClick"
            Orientation="Horizontal">
            <DataBindings>
                <asp:MenuItemBinding DataMember="SiteMapNode" TextField="Title" />
            </DataBindings>
        </asp:Menu>
   
    </div>
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
        ShowStartingNode="False" />
    <br />
    <br />
    <br />
    <asp:Menu ID="Menu2" runat="server" DataSourceID="SiteMapDataSource2"
        onmenuitemclick="Menu2_MenuItemClick" Orientation="Horizontal">
    </asp:Menu>
    <asp:SiteMapDataSource ID="SiteMapDataSource2" runat="server"
        EnableViewState="False" StartingNodeOffset="-1"
        StartingNodeUrl="~/Menu/Cases/Cases/twomenu/Default.aspx?node=hardware" />
    </form>
</body>
</html>

2. the codebehind:

protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
    {
        switch (e.Item.Value)
        {
            case "Products":
                SiteMapDataSource2.StartingNodeUrl = "Default.aspx?node=hardware";
                return;
            case "Services":
                SiteMapDataSource2.StartingNodeUrl = "Default.aspx?node=consulting";
                return;
            case "Support":
                SiteMapDataSource2.StartingNodeUrl = "Default.aspx?node=drivers";
                return;

        }
    }

3.  the sitemap file:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">

  <siteMapNode title="Home">
    <siteMapNode title="Products">
      <siteMapNode title="Hardware" url="~/Menu/Cases/Cases/twomenu/Default.aspx?node=hardware">
        <siteMapNode title="Mouse"/>
        <siteMapNode title="Keyboard"/>
        <siteMapNode title="NetCard"/>
        <siteMapNode title="Monitor"/>
        <siteMapNode title="PC"/>
      </siteMapNode>
      <siteMapNode title="Software" url="Default.aspx?node=software">
        <siteMapNode title="Spreadsheet"/>
        <siteMapNode title="Word Processor"/>
        <siteMapNode title="Presentation"/>
        <siteMapNode title="Mail"/>
        <siteMapNode title="Games"/>
      </siteMapNode>
      <siteMapNode title="Books" url="Default.aspx?node=books">
        <siteMapNode title="Programming"/>
        <siteMapNode title="Debugging"/>
        <siteMapNode title="Testing"/>
        <siteMapNode title="Web Apps"/>
        <siteMapNode title="WinForm Apps"/>
      </siteMapNode>
    </siteMapNode>
    <siteMapNode title="Services">
      <siteMapNode title="Consulting" url="Default.aspx?node=consulting">
        <siteMapNode title="Processes"/>
        <siteMapNode title="Management"/>
        <siteMapNode title="Recruiting"/>
      </siteMapNode>
      <siteMapNode title="Development" url="Default.aspx?node=development">
        <siteMapNode title="Web Apps"/>
        <siteMapNode title="Enterprise Apps"/>
        <siteMapNode title="Database"/>
      </siteMapNode>
    </siteMapNode>
    <siteMapNode title="Support">
      <siteMapNode title="Drivers" url="Default.aspx?node=drivers">
        <siteMapNode title="Audio"/>
        <siteMapNode title="Network"/>
        <siteMapNode title="Printer"/>
        <siteMapNode title="Modem"/>
      </siteMapNode>
      <siteMapNode title="Manuals" url="Default.aspx?node=manuals">
        <siteMapNode title="Applications"/>
        <siteMapNode title="Troubleshooting"/>
        <siteMapNode title="Installation"/>
        <siteMapNode title="Internet"/>
      </siteMapNode>
      <siteMapNode title="Updates" url="Default.aspx?node=updates">
        <siteMapNode title="Release 1"/>
        <siteMapNode title="Game Package"/>
      </siteMapNode>
    </siteMapNode>
  </siteMapNode>

</siteMap>

 

Hope it helps.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008
Professional Visual Studio 2005 Authors: Andrew Parsons, Nick Randolph, Pages: 869, Published: 2006
ASP.NET 2.0 Website Programming: Problem-design-solution Authors: Marco Bellinaso, Pages: 576, Published: 2006
Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages Authors: Jacob J. Sanford, Pages: 474, Published: 2007
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Amazon.com Mashups Authors: Francis Shanahan, Pages: 379, Published: 2006
Professional ASP.NET 3.5: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1673, Published: 2008
Pro ASP.NET 2.0 in C# 2005: Create Next-generation Web Applications with the Latest Version of Microsoft's Revolutionary Technology Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1426, Published: 2006
Beginning ASP.NET 2.0 in VB 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1063, Published: 2006

Web:
Designing Menu using Sitemap and asp menu control « Tech Dec 6, 2007 ... Then we can use asp menu control and point the DatasourceId to the ... the same of method of menu with sitemap data source. my problem is, ...
problem with menu control and sitemap - ASP.NET Forums Re: problem with menu control and sitemap. 01-11-2008, 7:51 AM. Contact ... Re: problem with menu control and sitemap. 01-11-2008, 11:51 AM ...
CodeProject: Using Menu and Sitemap with Master page. Free source ... Aug 13, 2006 ... Although I have never used this menu control myself before, it seems to me that the menus use the sitemap nodes in the XML file as ...
ASP.NET 2.0: Using the Menu Control Here we will take a look at two different ways to set up the Menu Control. One, with the default SiteMap provider using a standard Xml web. ...
CodeProject: Populating Menu Control in ASP.NET 2.0 - using ... This is the preferred way of populating the Menu control. SiteMapDataSource allows you to read the information from the .sitemap file which is simply an XML ...
asp:menu control and SiteMap, 'Selected' Item must match exact url ... May 22, 2008 ... And then every folder has a Default.aspx ... but the problem with this is that the sitemap, when connected to an ASP.NET Menu control ...
Menu Control with sitemap Problem? - ASP.NET Forums Menu Control with sitemap Problem? Last post 11-13-2007 1:26 AM by Amanda Wang - MSFT. 2 replies. Sort Posts: ...
ASP.NET’s Menu control offers another site map navigation option ... This site map file can easily be used to populate a Menu control. .... Avoid problems by regularly checking site links · Converting an existing application ...
ASP.NET's Menu control offers another site map navigation option ... Oct 18, 2007 ... This site map file can easily be used to populate a Menu control. .... NET's MVC framework · Avoid problems when redirecting via drop-down ...
ASP.NET - Menu Control Using Site Map | DreamInCode.net Oct 21, 2008 ... ASP.NET - Menu Control Using Site Map. Get help with this and thousands of other programming and web development topics at DreamInCode.net.

Videos:
Adding Visual Studio 2008 Menu Control to A Website Navigation is very important in a website, in this video i'll be showing you how to easily add navigation to your website using the web.sitemap ...




Search This Site:










how to set a image path to consume multiple themes?

server.transfer and controlplaceholders

variable in web.sitemap

target property of menu control

virtualpathprovider question

how set virtual address of a <td> background tag

master pages and safari incompatibility?

menu with seperators

treeview - listing folder content.

one masterpage with gridview for using in child pages.

menu control: which item clicked?

simple menu navigation image question

how to handle masterpage's event in content page? (c#)

creating a expandable menu with treeview

100% width and height masterpage?

master page control question

master pages, content pages title problem

visible and invisible sub-menu link?

button click event

accessing content controls from codebehind

query regarding menu control in master page

how to disable tree view parent node or child node

can someone explain this treeview oninit exception

custom treeview control selectednodechanged event not firing up.

menu in vwd

are contentpages cached?

change masterpage

help with css button color scheme

sitemap

stop page flickering on tree node expand/collapse

  Privacy | Contact Us
All Times Are GMT