dynamic where clause when dropdown selected
I have multiple dropdowns which is taking information from sql there I
have no problems and show as per below:
<asp:DropDownList ID="ports" runat="server" AutoPostBack="True"
DataSourceID="AccessDataSource4" DataTextField="ports"
DataValueField="ports">
</asp:DropDownList>
I have also a gridview which is showing information from other accessdata
source as per below:
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/kdatabase.accdb"
SelectCommand="SELECT * FROM [Devices] WHERE ([design] LIKE
@design) AND ([ports] LIKE @ports) ">
<SelectParameters>
<asp:ControlParameter DefaultValue="%" ControlID="design"
Name="design" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter DefaultValue="%" ControlID="ports"
Name="ports" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:AccessDataSource>
Which is working fine but not %100 that I am looking for.What I want is
that Where Clause is addded under Select command for the database only if
I change the dropdown list.If i did not change it I want that my gridview
show all the results.How I can do it.Static dropdown is easy but I have
dynamic dropdown.
No comments:
Post a Comment