Answer to Question #182941 in ASP | ASP.NET for Priyal Patel

Question #182941
  1. Create a Web page "FriendInfo.aspx" with the following elements:
  2. When the Web page loads, the "Email" property contained in the query string passed from the "MemberHome.aspx" Web page is stored in a global "Email" variable of type string
  3.  
  4. A "Submit" asp:Button control that when clicked submits the global "Email" string variable in a query string to the "MemberHome.aspx" Web page

 





1
Expert's answer
2021-04-19T07:03:31-0400
MemberHome.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MemberHome.aspx.cs" Inherits="FacePamphlet.Default" %>


<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <br />
            <asp:Button ID="btnFriendInfo" runat="server" OnClick="btnFriendInfo_Click" Text="Friend Info" />
        
        </div>
    </form>
</body>
</html>



The file "MemberHome.aspx.cs "


using System;




namespace FacePamphlet

{

  public partial class Default : System.Web.UI.Page

  {

    /// <summary>

    /// the global "Email" string variable in a query string to the "MemberHome.aspx" Web page

    /// </summary>

    public static string Email;

    protected void Page_Load(object sender, EventArgs e)

    {

      Email = "test@gmail.com";

    }




    protected void btnFriendInfo_Click(object sender, EventArgs e)

    {

      Response.Redirect("FriendInfo.aspx");

    }

  }

}



The file "FriendInfo.aspx"


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FriendInfo.aspx.cs" Inherits="FacePamphlet.FriendInfo" %>


<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" Text="Submit" />
            <br />
            <asp:Label ID="lblEmail" runat="server" Text="Email"></asp:Label>
        </div>
    </form>
</body>
</html>



The file "FriendInfo.aspx.cs":


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


namespace FacePamphlet
{
    public partial class FriendInfo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {


        }


        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            lblEmail.Text = Default.Email;
        }
    }
}


Example:


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS