VS 2008 Express, ASP.Net, VB.Net, Wesbsite Page, Experience Beginner
===================================================
I am trying to get a dropdown, with static values, to filter (select the where statement) DataList results.
I can get the dropdown to filter by a specific category, but have not been able to get any results when selecting ‘ALL CATEGORIES’
I don’t know what the dropdown value should be to return all category results when using the dropdown. If someone would be so kind to help, what should the following line of code look like to return all the results?
<asp:ListItem Value="*">All Categoriesasp:ListItem>
Thank you.
Mike
Here’s an example of the code:
[CODE]
<tr>
<td class="tableTwoMainBody"> qq<br />
<asp:DropDownList ID="ddAscDesc" runat="server" AutoPostBack="True">
<asp:ListItem Value="ListPrice asc">List Price Ascendingasp:ListItem>
<asp:ListItem Value="ListPrice desc">List Price Descendingasp:ListItem>
asp:DropDownList>
qq
<asp:DropDownList ID="ddPropCat" runat="server" AutoPostBack="True">
**THIS LINE <asp:ListItem Value="*">All Categoriesasp:ListItem>
<asp:ListItem>Single Familyasp:ListItem>
<asp:ListItem>Cottage/Rec Propertiesasp:ListItem>
<asp:ListItem>Condominiumsasp:ListItem>
<asp:ListItem>Fractional Ownershipasp:ListItem>
<asp:ListItem>Mobile/Miniasp:ListItem>
<asp:ListItem>Vacant Lot(s)asp:ListItem>
<asp:ListItem>Acreagesasp:ListItem>
<asp:ListItem>Otherasp:ListItem>
asp:DropDownList>
td>
tr>
<tr>
<td class="tableTwoMainBody">
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="ListingTableClassesDataContext"
Select="new (ListPrice, Photo1, ListingAddr1, ListingCity, reserveState, Photo1Caption, CustViewShortDesc, ViewNowLink, PropCategory, Bedrooms, FullBathrooms, HalfBathrooms, ListingID)"
TableName="Listings" OrderBy="ListPrice" Where="PropCategory == @PropCategory">
<OrderByParameters>
<asp:ControlParameter ControlID="ddAscDesc" Name="newparameter"
PropertyName="SelectedValue" />
OrderByParameters>
<WhereParameters>
<asp:ControlParameter ControlID="ddPropCat" Name="PropCategory"
PropertyName="SelectedValue" Type="String" />
WhereParameters>
asp:LinqDataSource>
<asp:DataList ID="DataList1" runat="server" DataSourceID="LinqDataSource1">
<ItemTemplate>
[CODE]
Vijaya KadiyalaPosted Mar 13, 2009, 5:32 PM
Hi
What value you are passing when you select "All Categories"? May be you need to write code if select all categoris then dont have any WHERE condition.
Thanks -- Vijaya Kadiyala
http://dotnetvj.blogspot.com