I used CalendarControl in asp.net.
i write code in selection change event.
-------------------------------------------
void Selection_Change()
{
Label1.Text = Calendar1.SelectedDate.ToString("dd-MM-yyyy");
}
-------------------------------------------
if i select 13 September 2013 than it retrieve 13-09-2013
but when i select today's date it not retrieve today's date.
label1 text is still 13-09-2013
??
Loading


Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 6, 2013, 11:12 PM EDT
i modified your .cs just check that.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace datepart
{
public partial class datepage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TimeZoneInfo INDIAN_ZONE = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
DateTime indianTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
Calendar1.SelectedDate = indianTime.Date;
}
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
Label1.Text = Calendar1.SelectedDate.ToString("dd-MM-yyyy");
}
}
}
Rosi Sreenivasa Reddy137 reputationPosted Sep 6, 2013, 10:26 PM EDT
i check ur code it is working fine
Rosi Sreenivasa Reddy137 reputationPosted Sep 6, 2013, 10:27 PM EDT
aspx.cs:
protected void selected_Date(object sender, EventArgs e)
{
label1.Text = Calendar1.SelectedDate.ToString("dd-MM-yyyy");
}
Vasu GadhiyaRank #7,540 · 239 reputationPosted Sep 6, 2013, 10:33 PM EDT
yes, it retrieve all days,
but if i select today's date it not retrieve today's date.
and label text cant change.
date not retrieve on only today's date.
thanks
Rosi Sreenivasa Reddy137 reputationPosted Sep 6, 2013, 10:51 PM EDT
can you send whole coding then i can able to understand...........and also what is your version..................
Vasu GadhiyaRank #7,540 · 239 reputationPosted Sep 6, 2013, 11:03 PM EDT
See attachment.
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 6, 2013, 11:09 PM EDT
try this sample:
in aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
in .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 Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
Calendar1.SelectedDate = DateTime.Today;
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
Label1.Text = Calendar1.SelectedDate.ToString();
}
}
Vasu GadhiyaRank #7,540 · 239 reputationPosted Sep 6, 2013, 11:22 PM EDT
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 6, 2013, 11:27 PM EDT
happy coding...
Rosi Sreenivasa Reddy137 reputationPosted Sep 7, 2013, 12:41 AM EDT
nice idea good keep going on