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="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Bield_Projects_Telephone_Default" %>
<!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>
<aspropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="PhoneNumber">Tel Number</asp:ListItem>
<asp:ListItem Value="SchemePostcode">Postcode</asp:ListItem>
</aspropDownList>
<asp:Button ID="Button1" runat="server" Text="Search" />
<br />
<br />
<aspetailsView 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>
</aspetailsView>
<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>
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="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Bield_Projects_Telephone_Default" %>
<!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>
<aspropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="PhoneNumber">Tel Number</asp:ListItem>
<asp:ListItem Value="SchemePostcode">Postcode</asp:ListItem>
</aspropDownList>
<asp:Button ID="Button1" runat="server" Text="Search" />
<br />
<br />
<aspetailsView 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>
</aspetailsView>
<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>