asked on
ASKER
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Project_CarPool._Default" Trace="true"%>
<!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>
<br />
<br />
Add your name and telephone number.<br />
<br />
<asp:DropDownList ID="ddlCity" runat="server" DataSourceID="dsCity" DataTextField="City_Name"
DataValueField="PK_City" AutoPostBack="True">
</asp:DropDownList><asp:SqlDataSource ID="dsCity" runat="server" ConnectionString="<%$ ConnectionStrings:Project_CarPoolConnectionString %>"
SelectCommand="SELECT [PK_City], [City_Name] FROM [City]"></asp:SqlDataSource>
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />
<br />
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="PK_User,PK_Lot,PK_City,PK_ContactInfo"
DataSourceID="dsAllPeopleAndLocations">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="PK_User" HeaderText="PK_User" ReadOnly="True" SortExpression="PK_User" />
<asp:BoundField DataField="PK_Lot" HeaderText="PK_Lot" ReadOnly="True" SortExpression="PK_Lot" />
<asp:BoundField DataField="Lot_Name" HeaderText="Lot_Name" SortExpression="Lot_Name" />
<asp:BoundField DataField="FK_Lot_City" HeaderText="FK_Lot_City" SortExpression="FK_Lot_City" />
<asp:BoundField DataField="PK_City" HeaderText="PK_City" ReadOnly="True" SortExpression="PK_City" />
<asp:BoundField DataField="City_Name" HeaderText="City_Name" SortExpression="City_Name" />
<asp:BoundField DataField="User_FirstName" HeaderText="User_FirstName" SortExpression="User_FirstName" />
<asp:BoundField DataField="User_LastName" HeaderText="User_LastName" SortExpression="User_LastName" />
<asp:BoundField DataField="FK_User_Lot" HeaderText="FK_User_Lot" SortExpression="FK_User_Lot" />
<asp:BoundField DataField="FK_User_ContactInfo" HeaderText="FK_User_ContactInfo"
SortExpression="FK_User_ContactInfo" />
<asp:BoundField DataField="PK_ContactInfo" HeaderText="PK_ContactInfo" ReadOnly="True"
SortExpression="PK_ContactInfo" />
<asp:BoundField DataField="ContactInfo_Tele" HeaderText="ContactInfo_Tele" SortExpression="ContactInfo_Tele" />
<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="dsAllPeopleAndLocations" runat="server" ConnectionString="<%$ ConnectionStrings:Project_CarPoolConnectionString %>"
SelectCommand="select * FROM Lot INNER JOIN City ON Lot.FK_Lot_City = City.PK_City INNER JOIN UserS INNER JOIN ContactInfo ON UserS.FK_User_ContactInfo = ContactInfo.PK_ContactInfo ON Lot.PK_Lot = UserS.FK_User_Lot ">
</asp:SqlDataSource>
<br />
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="PK_ContactInfo"
DataSourceID="dsDetailsOfContactInfo" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="PK_ContactInfo" HeaderText="PK_ContactInfo" ReadOnly="True"
SortExpression="PK_ContactInfo" />
<asp:BoundField DataField="ContactInfo_Tele" HeaderText="ContactInfo_Tele" SortExpression="ContactInfo_Tele" />
<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
<asp:CommandField ShowEditButton="True" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="dsDetailsOfContactInfo" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:Project_CarPoolConnectionString %>" DeleteCommand="DELETE FROM [ContactInfo] WHERE [PK_ContactInfo] = @original_PK_ContactInfo AND [ContactInfo_Tele] = @original_ContactInfo_Tele AND [Email] = @original_Email"
InsertCommand="INSERT INTO [ContactInfo] ([PK_ContactInfo], [ContactInfo_Tele], [Email]) VALUES (@PK_ContactInfo, @ContactInfo_Tele, @Email)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [ContactInfo] WHERE ([PK_ContactInfo] = @PK_ContactInfo)"
UpdateCommand="UPDATE [ContactInfo] SET [ContactInfo_Tele] = @ContactInfo_Tele, [Email] = @Email WHERE [PK_ContactInfo] = @original_PK_ContactInfo AND [ContactInfo_Tele] = @original_ContactInfo_Tele AND [Email] = @original_Email">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="PK_ContactInfo" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="original_PK_ContactInfo" Type="Int32" />
<asp:Parameter Name="original_ContactInfo_Tele" Type="String" />
<asp:Parameter Name="original_Email" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ContactInfo_Tele" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="original_PK_ContactInfo" Type="Int32" />
<asp:Parameter Name="original_ContactInfo_Tele" Type="String" />
<asp:Parameter Name="original_Email" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="PK_ContactInfo" Type="Int32" />
<asp:Parameter Name="ContactInfo_Tele" Type="String" />
<asp:Parameter Name="Email" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
ASKER
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace Project_CarPool
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = ddlCity.SelectedValue.ToString();
}
}
}
ASKER
ASKER
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.
TRUSTED BY
-------- aspx code
---- code behide
using system;