问题描述
在我的Default.aspx页面中,我有2个datalist,第一个填充了类别,第二个填充了颜色,(作为项目模板,我使用超链接),我有listview显示产品。 />
所以我想使用这两个数据列表对数据进行排序....当我选择一个类别时,listview在同一页面中填充了该类别,例如: - 默认.aspx?CategoryID = 1
(我已经这样做了)...但是当我想要这个类别的产品也按照
颜色排序现在这里是问题... !!!我不知道如何实现这个目标:\
我知道在选择第二个数据主义颜色之后,网址应该是这样的:
Default.aspx?CategoryID = 1& Color = red
或
Default.aspx?CategoryID = 1& ColorID = 1
任何想法?!
这里是代码
In my Default.aspx page I have 2 datalist, first one is populated with categories and second one is populated with colors, ( as item template for both of them im using hyperlink) and I have listview that shows products.
So i want to sort data using those two datalists.... when I select one of categories the listview is populated with that category in the same page for e.g : - Default.aspx?CategoryID=1
( which i have done that)... but when I want this category products to be also sorted by
colors now here is the problem ...!!! I dont know how to achieve that :\
I know that after selecting second datalist whith color, url should be something like this:
Default.aspx?CategoryID=1&Color=red
or
Default.aspx?CategoryID=1&ColorID=1
any idea ?!
HERE IS Code
<div class="Div1" style="width: 150px; float: left;">
<p>
<asp:DataList ID="CateoriesDataList" runat="server">
<HeaderTemplate>
Categories
</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="CategoryHyperLink" runat="server" Text='<%#Eval("CategoryName").ToString() %>'
NavigateUrl='<%#String.Format("Categories.aspx?Category=" + (Eval("CategoryID").ToString() + "&" +Request.QueryString.ToString())) %>'></asp:HyperLink>
</ItemTemplate>
</asp:DataList>
</p>
<p>
<asp:DataList ID="ColorsDataList" runat="server">
<HeaderTemplate>
Colors
</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="ColorLink" runat="server" Text='<%# Eval("Color").ToString() %>'
NavigateUrl='<%#String.Format("Categories.aspx?Category=" + (Eval("CategoryID").ToString() + "&" +Request.QueryString.ToString())) %>'></asp:HyperLink>
</ItemTemplate>
</asp:DataList>
</p>
</div>
<div class="Div2" style="float: left; width: 300px;">
<asp:DataList ID="ProductsDataList" runat="server">
<HeaderTemplate>
Products
</HeaderTemplate>
<ItemTemplate>
<asp:Image ID="Image1" runat="server" Height="53px" Width="65px" />
<asp:HyperLink ID="HyperLink3" runat="server">HyperLink</asp:HyperLink>
<br />
</ItemTemplate>
</asp:DataList>
</div>
所以它就像你从Footlocker.com上兜售鞋子......然后你做了一些分类湖:篮球鞋,价格,品牌,尺寸等等
这就是我的问题
我喜欢选择类别然后我喜欢按颜色或价格对所选数据进行排序......我的Default.asx?CategoryID = 1& colorID = 1再次显示不重复的参数我想按类别exp过滤:Default.asx?CategoryID = 3& CategoryID = 1& colorID = 1
if有人有任何想法,或者可以引导我到另一个引起这类问题的来源,我会非常感激...
我真实地认识你的时间
So its something like when you baying shoes from Footlocker.com ... and then you doing some kind of sorting lake: Basketball shoes, price, brand, size... etc
so thats my issue
I like to select category then i like to sort selected data by color or price...and my Default.asx?CategoryID=1&colorID=1 not to show duplicated parameters when again I want to filter by categories exp: Default.asx?CategoryID=3&CategoryID=1&colorID=1
if someone have any idea or can lead me to another source which referes to this kind of issues, I will be very thankful...
I Appreciete your time truely
推荐答案
这篇关于如何使用查询字符串对数据进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!