Calender Control Selected Date Value
Calender Control & Today DateTime Control Basic Working Conditions Display Label When Calender Click Event Uaing in Asp.Net C#.
DEMO
Download Coding
Download
HTML CODING
Calender Control & Today DateTime Control Basic Working Conditions Display Label When Calender Click Event Uaing in Asp.Net C#.
DEMO
Download Coding
Download
HTML CODING
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Calendar ID="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged"></asp:Calendar>
<br />
<br />
<asp:Label ID="lblCalenderDisplay" runat="server" ForeColor="Red" Font-Size="XX-Large"></asp:Label>
</div>
</form>
</body>
</html>
C# Coding
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToShortTimeString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToShortDateString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToLongDateString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToLongTimeString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToLocalTime().ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToLocalTime().ToShortTimeString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToLocalTime().ToShortDateString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToLocalTime().ToLongTimeString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToLocalTime().ToLongDateString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToFileTime().ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToFileTimeUtc().ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToUniversalTime().ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToUniversalTime().ToShortTimeString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToUniversalTime().ToShortDateString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.ToBinary().ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.TimeOfDay.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.TimeOfDay.Ticks.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.TimeOfDay.TotalHours.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.TimeOfDay.TotalMinutes.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.TimeOfDay.Hours.ToString();
string a = "10/10/2015";
lblCalenderDisplay.Text = Calendar1.SelectedDate.Subtract(Convert.ToDateTime(a)).ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.Subtract(Convert.ToDateTime(a)).Days.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.Subtract(Convert.ToDateTime(a)).TotalDays.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.Subtract(Convert.ToDateTime(a)).TotalHours.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.Subtract(Convert.ToDateTime(a)).TotalSeconds.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.Subtract(Convert.ToDateTime(a)).Ticks.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.Date.Ticks.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.Day.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.Month.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.Year.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.DayOfWeek.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.DayOfYear.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.Hour.ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.AddDays(10).ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.AddHours(21).ToShortTimeString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.AddMonths(3).ToShortDateString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.AddTicks(10).ToString();
lblCalenderDisplay.Text = Calendar1.SelectedDate.AddYears(2).Year.ToString();
lblCalenderDisplay.Text = Calendar1.TodaysDate.ToShortDateString();
lblCalenderDisplay.Text = Calendar1.SelectedDates.Count.ToString();
lblCalenderDisplay.Text = Calendar1.VisibleDate.ToString();
lblCalenderDisplay.Text = Calendar1.Visible.ToString();
lblCalenderDisplay.Text = Calendar1.NextPrevFormat.ToString();
string b = "06/13/2015";
lblCalenderDisplay.Text = Calendar1.Visible.Equals(Convert.ToDateTime(b)).ToString();
lblCalenderDisplay.Text = DateTime.Now.ToString();
lblCalenderDisplay.Text = DateTime.Now.ToShortTimeString();
lblCalenderDisplay.Text = DateTime.Now.ToShortDateString();
lblCalenderDisplay.Text = DateTime.Now.ToUniversalTime().ToString();
lblCalenderDisplay.Text = DateTime.Now.ToUniversalTime().ToLongDateString();
lblCalenderDisplay.Text = DateTime.Now.ToOADate().ToString();
lblCalenderDisplay.Text = DateTime.Now.Day.ToString();
lblCalenderDisplay.Text = DateTime.Now.AddDays(2).Date.ToString();
lblCalenderDisplay.Text = DateTime.Now.AddYears(2).Year.ToString();
lblCalenderDisplay.Text = DateTime.UtcNow.ToString();
lblCalenderDisplay.Text = DateTime.Today.ToString();
lblCalenderDisplay.Text = DateTime.MaxValue.ToString();
lblCalenderDisplay.Text = DateTime.MinValue.ToString();
lblCalenderDisplay.Text = DateTime.MaxValue.Year.ToString();
lblCalenderDisplay.Text = DateTime.DaysInMonth(2015, 2).ToString();
lblCalenderDisplay.Text = DateTime.DaysInMonth(2016, 2).ToString();
}
}
0 comments:
Post a Comment