Code : LinkButton.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:LinkButton ID="lnkbtnTimeNow" runat="server" OnClick="lnkbtnTimeNow_Click">Click for Current Time</asp:LinkButton>
<br />
<br />
<asp:Label ID="lblMsg" runat="server" text="[TIME]"></asp:Label>
</div>
</form>
</body>
</html>
Code: LinkButton.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Linkbutton : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void lnkbtnTimeNow_Click(object sender, EventArgs e)
{
lblMsg.Text = "Current Time : "+DateTime.Now.ToString();
}
}
No comments:
Post a Comment