Create a Web Site to display Message as shown in output to Handling Events and Post backs property Of Web page also display Current date & time in a label.
******HTML Code*****************************
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title></title>
- </head>
- <body>
- <form id="form1" runat="server">
- <div style="Margin-left:38px; height: 206px;">
- <br />
- Enter Your Name :
- <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
- <br />
- <br />
- <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
- <br />
- <br />
- <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
- <br />
- <br />
- <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Show" />
- </div>
- </form>
- </body>
- </html>
******C# Code*****************************
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- public partial class Display_Date_Time_And_Message : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- Label1.Text = TextBox1.Text + " " + "Welcome To Facebook";
- Label2.Text = DateTime.Now.ToString();
- }
- }

No comments:
Post a Comment