How to set VisibleDate property of asp:Calendar control
Calendar Web Server Control in ASP.NET
<h3>Calendar Control VisibleDate Property</h3>
<asp:Calendar ID="Calendar1" runat="server"
VisibleDate="1973-10-17"
ToolTip="Calendar Control VisibleDate Style"
SelectionMode="Day"
DayNameFormat="Full"
FirstDayOfWeek="Sunday"
ForeColor="#6600CC" Height="183px"
ShowGridLines="True" Width="459px">
<DayHeaderStyle BackColor="#66FF66" />
<SelectedDayStyle BackColor="Red" />
<TodayDayStyle BackColor="White" />
</asp:Calendar>
Note: This is the only property user can set at design time. Selected Date is not allowed at design time. So coming to Visible date style, There is no Style for VisibleDate. We need to set selected date ad VisibleDate(set set at design time), so that Selected day style will appear(Assuming SelectionMode is Day.
Page_Load set SelectedDate as VisibleDate
C#
protected void Page_Load(object sender, EventArgs e)
{
Calendar1.SelectedDate = Calendar1.VisibleDate;
}
VB.NET
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Calendar1.SelectedDate = Calendar1.VisibleDate
End Sub
Here is the Output
VisibleDate Style
Tags:Calendar Web Server Control,Calendar Control,Calendar VisibleDate Property,Calendar Selected Date Style,asp.net webserver calendar control
No comments:
Post a Comment