Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple search with drop down menu to choose which column to search on?

Status
Not open for further replies.

JGKWORK

IS-IT--Management
Apr 1, 2003
342
GB
Hi - just getting back in to web development after several years (and the last time I did this it was classic ASP help!).

Basically using Microsoft web developer 2010 to do a simple search against a db. I have one textbox and one drop down menu (which will be used to choose which column in the db to search against).

I have the textbox only search working but don't know how to implement the dropdown menu part?

Code so far (the drop down has just been added to the form here nothing more):

Really appreciate any help thanks:

___________________________________________________________
<%@ Page Language=&quot;VB&quot; AutoEventWireup=&quot;false&quot; CodeFile=&quot;Default.aspx.vb&quot; Inherits=&quot;Bield_Projects_Telephone_Default&quot; %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
<html xmlns="<head runat="server">
<title></title>
</head>
<body bgcolor="#f2f7ff">
<form id="form1" runat="server">
<div>

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
&nbsp;
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="PhoneNumber">Tel Number</asp:ListItem>
<asp:ListItem Value="SchemePostcode">Postcode</asp:ListItem>
</asp:DropDownList>
&nbsp;
<asp:Button ID="Button1" runat="server" Text="Search" />
<br />
<br />
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="AccessDataSource1"
EmptyDataText="“Sorry but no associated database records related to your query”. "
Height="50px" Width="429px">
<Fields>
<asp:BoundField DataField="SchemeNumber" HeaderText="SchemeNumber"
SortExpression="SchemeNumber" />
<asp:BoundField DataField="SchemeAddress" HeaderText="SchemeAddress"
SortExpression="SchemeAddress" />
<asp:BoundField DataField="SchemePostcode" HeaderText="SchemePostcode"
SortExpression="SchemePostcode" />
<asp:BoundField DataField="LineType" HeaderText="LineType"
SortExpression="LineType" />
<asp:BoundField DataField="PhoneNumber" HeaderText="PhoneNumber"
SortExpression="PhoneNumber" />
</Fields>
</asp:DetailsView>
<br />
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/Databases/Test.mdb"
SelectCommand="SELECT [SchemeNumber], [SchemeAddress], [SchemePostcode], [LineType], [PhoneNumber] FROM [Qry_PhoneNumbersbyScheme_LC] WHERE ([PhoneNumber] = ?)">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="PhoneNumber"
PropertyName="Text" Type="String" />
</SelectParameters>
</asp:AccessDataSource>

</div>
</form>
</body>
</html>
 
Hello? Can anyone out there help please?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top