CST272 Final Project

"Insert Friend Page"


  1. Create a Web page "InsertFriend.aspx" with the following elements:
  1. When the web page loads, the "Email" property contained in the query string passed from the "MemberHome.aspx" web page is stored in a private instance variable "Email" of type string
     
  2. An asp:SqlDataSource control that returns the all fields from the Friends table
     
    • InsertParameters need to be created for the MyEMail and FriendEMail fields
    • (It is not necessary to include Update and Delete SQL statements and their related parameters, so these elements should be deleted from the ASP.NET code)

    InsertFriend.png

  3. An asp:SqlDataSource control that returns the EMail field from the Members table as well as the "FirstName" concatenated to the "LastName" field (with a space between) as alias MemberName for all records except the logged in user (the one that matches the "EMail" property stored in the query string passed from the click event of the "Submit" button in the "MemberHome.aspx" Web page) and any users that already are friends with the logged in user; this complicated SQL SELECT statement involves the use of a subquery (see Note below)

    Note: For information on how to create SQL SELECT statements with subqueries, click this Subqueries (SQL Server) - SQL Server link; the WHERE clause which contains the subquery for the SelectCommand of this SqlDataSource should take form:

    WHERE ... AND EMail IN (subquery here)

  1. A "Submit" asp:Button control that when clicked assigns the following values to the "Friends" SqlDataSource InsertParameters :
     
    1. MyEmail from the global "Email" string variable (see item a above)
    2. FriendEMail from the DataValueField property of the DropDownList control (see item c above)

    The Button click event handler then continues by inserting the new record into the "Friends" table after after which control returns to the "MemberHome.aspx" web page passing it the private instance variable "Email" as a query string value

  2. A "Cancel" asp:Button control that when clicked returns to the "MemberHome.aspx" web page passing it the private instance variable "Email" as a query string value