Visual Web Developer 2005 Express
Access
Code in VB
I have created Access Database (PartSearch.mdb) with one table called Parts
Parts has four columns
ProductID / PartNumber / ProductName / ProductDescription
|1| 1111| First | Item|
|2| 2222| Second| Item|
|3| 3333| Third | Item|
I would like to have a drop down menu that when I pull the menu down and select the part number the information will be shown in a FormView to the side of the drop down.
Steps I have taken:
Created the database called PartSearch.mdb (located in the App Data directory)
Placed a drop down control and set the Data Source as AccessDataSource1 / data field to display as PartNumber / data field for the value as PartNumber
Placed a FormView to the right of the drop down
Set the Data Source as AccessDataSource2 with specific columns as PartNumber / PartName/ ProductDescription
Can someone assist in my next step (code / what to use / where to place it). I do not need to edit / update or anything else, just show the information.
Code:<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"><title>Untitled Page</title></head> <body> <form id="form1" runat="server"> <div> <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="AccessDataSource1"DataTextField="PartNumber" DataValueField="PartNumber" Style="z-index: 100; left: 202px;position: absolute; top: 118px"></asp:DropDownList> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/PartSearch.mdb"SelectCommand="SELECT [PartNumber] FROM [Parts]"></asp:AccessDataSource> <asp:FormView ID="FormView1" runat="server" DataSourceID="AccessDataSource2" Style="z-index: 101;left: 301px; position: absolute; top: 121px"> <EditItemTemplate>PartNumber:<asp:TextBox ID="PartNumberTextBox" runat="server" Text='<%# Bind("PartNumber") %>'> </asp:TextBox><br /> ProductName:<asp:TextBox ID="ProductNameTextBox" runat="server" Text='<%# Bind("ProductName") %>'></asp:TextBox><br /> ProductDescription:<asp:TextBox ID="ProductDescriptionTextBox" runat="server" Text='<%# Bind("ProductDescription") %>'></asp:TextBox><br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"Text="Update"></asp:LinkButton> <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"Text="Cancel"></asp:LinkButton> </EditItemTemplate> <InsertItemTemplate>PartNumber:<asp:TextBox ID="PartNumberTextBox" runat="server" Text='<%# Bind("PartNumber") %>'></asp:TextBox><br /> ProductName:<asp:TextBox ID="ProductNameTextBox" runat="server" Text='<%# Bind("ProductName") %>'></asp:TextBox><br /> ProductDescription:<asp:TextBox ID="ProductDescriptionTextBox" runat="server" Text='<%# Bind("ProductDescription") %>'></asp:TextBox><br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"Text="Insert"></asp:LinkButton> <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"Text="Cancel"></asp:LinkButton> </InsertItemTemplate><ItemTemplate>PartNumber:<asp:Label ID="PartNumberLabel" runat="server" Text='<%# Bind("PartNumber") %>'></asp:Label><br /> ProductName:<asp:Label ID="ProductNameLabel" runat="server" Text='<%# Bind("ProductName") %>'></asp:Label><br /> ProductDescription:<asp:Label ID="ProductDescriptionLabel" runat="server" Text='<%# Bind("ProductDescription") %>'></asp:Label><br /> </ItemTemplate></asp:FormView><asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/PartSearch.mdb"SelectCommand="SELECT [PartNumber], [ProductName], [ProductDescription] FROM [Parts]"> </asp:AccessDataSource> </div></form></body></html>


Reply With Quote
Bookmarks