Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I am trying to display different products from my db by the category number. The problem is that I can get all the products but I can't get specific products for certain category.
The following error is throw when I try to see the Products from the Category 'Accessories'.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /ProductsList.aspx
<asp:ListView ID="ListView_ProductsMenu" runat="server" 
                DataKeyNames="CategoryID" DataSourceID="EDS_Category_Menu">
                <emptydatatemplate>No Menu Items.</emptydatatemplate>
                <itemseparatortemplate></itemseparatortemplate>
                <itemtemplate>
                    <li>
                    <a href="<%# VirtualPathUtility.ToAbsolute("~/ProductsList.aspx?CategoryId=" + Eval("CategoryID")) %>"><%# Eval("CategoryName") %></a>
                    </li>
                </itemtemplate>               
                <layouttemplate>
                    <ul ID="itemPlaceholderContainer"  runat="server" style="font-family: Verdana, Arial, Helvetica, sans-serif;">
                        <li  runat="server" id="itemPlaceholder" />
                    
                    <div style="text-align: left;background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-serif;color: #333333;"></div>
                </layouttemplate>
            
            <asp:EntityDataSource ID="EDS_Category_Menu" runat="server" EnableFlattening="False" 
                                  ConnectionString="name=OnlineRetailStoreEntities" DefaultContainerName="OnlineRetailStoreEntities" EntitySetName="Categories">
Posted
Comments
Sergey Alexandrovich Kryukov 15-May-11 12:32pm    
How anyone can help if your page is absent? By writing this page for you? :-)
--SA
Sandeep Mewara 15-May-11 15:16pm    
Page was misplaced. Looks like he pointed it correctly now. :)
jalmonte 15-May-11 13:01pm    
Maybe looking the code where I am trying to retrieve the Product by the CategoryId, could be wrong :D.
I followed this tutorial: http://www.asp.net/web-forms/tutorials/tailspin-spyworks-part-4. Everything is working except to list the products by it category...

1 solution

VirtualPathUtility.ToAbsolute("~/ProductsList.aspx?CategoryId=" + Eval("CategoryID")) %>"><%# Eval("CategoryName")

Sounds like there is an issue in forming the URL. Currently, the URL formed is incorrect and thus when you try to move to that URL, no page is found and you get a 404 error.

Try this tip to get the correct URL: Resolving Paths in a Multi-Folder WebSite[^]

For now, it looks like the URL is trying to find the 'ProductsList.aspx' in the root folder. For once, try moving it there and see it.
 
Share this answer
 
Comments
jalmonte 15-May-11 15:07pm    
Thanks so much man!!! I solved the problem. You was right!
Sandeep Mewara 15-May-11 15:15pm    
Good to know! :thumbsup:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900