Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a Web page InsertFriend.aspx with the following elements: When the web page loads, the Email property contained in the query string passed from the
Create a Web page "InsertFriend.aspx" with the following elements:
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
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
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
This SqlDataSource is linked to an asp:DropDownList control
The DataValueField for the DropDownList is the "EMail" field, but the DataTextField is the concatenated "MemberName" field see image above
A "Submit" asp:Button control that when clicked assigns the following values to the "Friends" SqlDataSource InsertParameters :
MyEmail from the global "Email" string variable see item a above
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
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started