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 LenkaPosted Sep 7, 2013, 3:12 AM
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 ReddyPosted Sep 7, 2013, 4:41 AM
nice idea good keep going on
Sanjeeb LenkaPosted Sep 7, 2013, 3:27 AM
happy coding...
Vasu GadhiyaPosted Sep 7, 2013, 3:22 AM
Sanjeeb LenkaPosted Sep 7, 2013, 3:09 AM
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 GadhiyaPosted Sep 7, 2013, 3:03 AM
See attachment.
Rosi Sreenivasa ReddyPosted Sep 7, 2013, 2:51 AM
can you send whole coding then i can able to understand...........and also what is your version..................
Vasu GadhiyaPosted Sep 7, 2013, 2:33 AM
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 ReddyPosted Sep 7, 2013, 2:27 AM
aspx.cs:
protected void selected_Date(object sender, EventArgs e)
{
label1.Text = Calendar1.SelectedDate.ToString("dd-MM-yyyy");
}
Rosi Sreenivasa ReddyPosted Sep 7, 2013, 2:26 AM
i check ur code it is working fine