Asked by:
How best to code hierarchy controls bound to sqldatasource for search feature on Listview

Question
-
User1909155429 posted
On my main product page I am having trouble getting my search controls to work in sequence.
They rely on other control for parameter values according to product selected from main menu. Each product can have variable properties from which to search in Listview.
such as: Name, Category, Type , Colour, Size, Gender , Age , Material....
Some items only have two properties to search on.
Wednesday, April 22, 2015 4:40 PM
All replies
-
User158442211 posted
Hi peterthegreat,
Thank you for your post.
Would you please provide your key code and aspx layout.
This will allow us to understand your needs better.
Best regard,
Amor
Wednesday, April 22, 2015 9:44 PM -
User-1716253493 posted
<asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>All</asp:ListItem> <asp:ListItem>Cat1</asp:ListItem> <asp:ListItem>Cat2</asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="DropDownList2" runat="server"> <asp:ListItem>All</asp:ListItem> <asp:ListItem>Red</asp:ListItem> <asp:ListItem>Green</asp:ListItem> <asp:ListItem>Blue</asp:ListItem> </asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="SELECT * FROM product WHERE (category=@category or @categoy='all') AND (color=@color or @color='all')"> <SelectParameters> <asp:ControlParameter ControlID="DropDownList1" Name="category" PropertyName="SelectedValue" /> <asp:ControlParameter ControlID="DropDownList2" Name="color" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource>
Wednesday, April 22, 2015 10:40 PM -
User1909155429 posted
That's not possible because the page contains lots of code for control.
You would need the whole project files!
The Sqldatasource controls that filter the server controls are not working as would expect when filtering on different item selections.
Consequently, I was wondering about a alternative approach of filtering?
Friday, April 24, 2015 10:34 AM -
User1909155429 posted
That is similar to what I have except i have various filter control that obtain their query parameters from multiple controls do not simultaneously work in tandem.
The child control has various parent controls!
Friday, April 24, 2015 10:41 AM