ListView显示ProductList [英] ListView to display ProductList

查看:155
本文介绍了ListView显示ProductList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试通过类别号显示与我的数据库不同的产品.问题是我可以获得所有产品,但无法获得特定类别的特定产品.
当我尝试从附件"类别中查看产品时,抛出以下错误.
找不到资源.
说明:HTTP404.您正在寻找的资源(或其依赖项之一)可能已被删除,名称更改或暂时不可用.请查看以下URL,并确保其拼写正确.
要求的网址:/ProductsList.aspx

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">

推荐答案

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


听起来在形成URL时存在问题.当前,所形成的URL不正确,因此当您尝试移动到该URL时,找不到页面,并且出现404错误.

尝试此技巧以获取正确的URL:解析多路径-Folder WebSite [ ^ ]

目前,URL似乎正在尝试在根文件夹中找到"ProductsList.aspx".一次,尝试将其移到那里并查看它.


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.


这篇关于ListView显示ProductList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆