How to Set the current data into Asp text box
How to Set the current data into Asp text box in asp.net programming:
In asp.net programming it is very simple that u set the current date in specific format .
if u want to set the current date in time and date both the
Code of Asp.net aspx page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Label_Control.aspx.cs" Inherits="Label_Control" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div><h1> Get time and date</h1>
</div>
<div>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<br />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</div>
</form>
</body>
</html>
Code of Asp.net aspx.cs page
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Label_Control : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text =System.DateTime.Now.ToString();
}
}