0% found this document useful (0 votes)
72 views

Calender Examples

This document contains code samples demonstrating different ways to customize the appearance and behavior of the ASP.NET Calendar control, including: 1) Applying themes and skin IDs to style calendars differently. 2) Programmatically enabling, disabling and changing properties of calendars like the font name. 3) Finding inactive profiles by user name in ASP.NET profiles. 4) Using the EnableTheming property to enable or disable theming on individual calendars.

Uploaded by

M4MAD
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

Calender Examples

This document contains code samples demonstrating different ways to customize the appearance and behavior of the ASP.NET Calendar control, including: 1) Applying themes and skin IDs to style calendars differently. 2) Programmatically enabling, disabling and changing properties of calendars like the font name. 3) Finding inactive profiles by user name in ASP.NET profiles. 4) Using the EnableTheming property to enable or disable theming on individual calendars.

Uploaded by

M4MAD
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

How to use theme and skin id (SkinID) in Calendar control

CalendarSkinID.aspx
<%@ Page Language="C#" Theme="CalenderSkinIDTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to use theme and skin id (SkinID) in Calendar
control</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Navy; font-style:italic;">Calendar Example:
Theme and SkinID</h2>
<table cellpadding="5">
<tr>
<td>
<asp:Calendar
ID="Calendar1"
runat="server"
SkinID="SaddleBrown"
>
</asp:Calendar>
</td>
<td>
<asp:Calendar
ID="Calendar2"
runat="server"
>
</asp:Calendar>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

CalenderSkinIDTest.skin
<asp:Calendar
runat="server"
BackColor="PaleVioletRed"
ForeColor="FloralWhite"
BorderWidth="2"
BorderColor="DarkRed"
>
<TitleStyle BackColor="IndianRed" ForeColor="Snow" Font-
Bold="true" />
<DayHeaderStyle BackColor="HotPink" />
<OtherMonthDayStyle BackColor="BurlyWood" />
<TodayDayStyle BackColor="HotPink" Font-Bold="true" />
</asp:Calendar>

<asp:Calendar
SkinID="SaddleBrown"
runat="server"
BackColor="SaddleBrown"
ForeColor="Wheat"
BorderWidth="1"
BorderColor="SaddleBrown"
>
<TitleStyle BackColor="Crimson" ForeColor="Snow" Font-Bold="true" />
<DayHeaderStyle BackColor="SandyBrown" />
<WeekendDayStyle BackColor="IndianRed" />
<TodayDayStyle BackColor="DarkRed" Font-Bold="true" />
</asp:Calendar>

How to enable, disable Calendar programmatically

CalendarEnable.aspx
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Drawing" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Page_Load(object sender, System.EventArgs e)
{
if(!this.IsPostBack)
{
Calendar1.BackColor = Color.DarkSalmon;
Calendar1.ForeColor = Color.Snow;
Calendar1.BorderColor = Color.SaddleBrown;
Calendar1.TitleStyle.BackColor = Color.SaddleBrown;
Calendar1.DayHeaderStyle.BackColor = Color.IndianRed;
}
}
protected void Button1_Click(object sender, System.EventArgs e)
{
Calendar1.Enabled = false;
Label1.Text = "Calendar now disable.";
}
protected void Button2_Click(object sender, System.EventArgs e)
{
Calendar1.Enabled = true;
Label1.Text = "Calendar now enable.";
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to enable, disable Calendar programmatically</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Navy; font-style:italic;">Calendar Example:
Enable Disable</h2>
<asp:Label
ID="Label1"
runat="server"
Font-Bold="true"
Font-Italic="true"
Font-Size="Large"
ForeColor="Crimson"
>
</asp:Label>
<br /><br />
<asp:Calendar
ID="Calendar1"
runat="server"
>
</asp:Calendar>
<br />
<asp:Button
ID="Button1"
runat="server"
ForeColor="SaddleBrown"
Text="Disable Calendar"
Height="45"
OnClick="Button1_Click"
Font-Bold="true"
/>
<asp:Button
ID="Button2"
runat="server"
ForeColor="SaddleBrown"
Text="Enable Calendar"
Height="45"
OnClick="Button2_Click"
Font-Bold="true"
/>
</div>
</form>
</body>
</html>

How to set, change Calendar font name programmatically

CalendarFontName.aspx
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Drawing" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Page_Load(object sender, System.EventArgs e)
{
if (!this.IsPostBack)
{
Calendar1.BackColor = Color.Crimson;
Calendar1.ForeColor = Color.FloralWhite;
Calendar1.BorderColor = Color.DarkRed;
Calendar1.TitleStyle.BackColor = Color.DarkOrange;
Calendar1.DayHeaderStyle.BackColor = Color.SaddleBrown;
}
}
protected void Button1_Click(object sender, System.EventArgs e)
{
Calendar1.Font.Name = "Arial";
}
protected void Button2_Click(object sender, System.EventArgs e)
{
Calendar1.Font.Name = "Comic Sans MS";
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to set, change Calendar font name
programmatically</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Navy; font-style:italic;">Calendar Example:
Font Name</h2>
<asp:Calendar
ID="Calendar1"
runat="server"
>
</asp:Calendar>
<br />
<asp:Button
ID="Button1"
runat="server"
ForeColor="DarkCyan"
Text="Calendar Font Arial"
Height="45"
OnClick="Button1_Click"
Font-Bold="true"
/>
<asp:Button
ID="Button2"
runat="server"
ForeColor="DarkCyan"
Text="Calendar Font Comic Sans MS"
Height="45"
OnClick="Button2_Click"
Font-Bold="true"
/>
</div>
</form>
</body>
</html>

How to find inactive profiles by user name in asp.net

FindInactiveProfilesByUserName.aspx
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
// set your own datetime which you need.
DateTime myDate = DateTime.Now;
GridView1.DataSource =
ProfileManager.FindInactiveProfilesByUserName(ProfileAuthenticationOptio
n.Authenticated,TextBox1.Text,myDate);
GridView1.DataBind();
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to find inactive profiles by user name in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Green">asp.net profile example<br />Find
Inactive Profiles By User Name</h2>
<asp:GridView
ID="GridView1"
runat="server"
AutoGenerateColumns="true"
AllowPaging="true"
BackColor="RosyBrown"
ForeColor="SaddleBrown"
HeaderStyle-BackColor="SaddleBrown"
HeaderStyle-Font-Italic="false"
HeaderStyle-ForeColor="RosyBrown"
BorderColor="SaddleBrown"
GridLines="Horizontal"
Font-Italic="true"
>
</asp:GridView>
<br />
<asp:Label
ID="Label1"
runat="server"
Font-Bold="true"
ForeColor="SeaGreen"
Text="User Name"
>
</asp:Label>
<asp:TextBox
ID="TextBox1"
runat="server"
BackColor="SeaGreen"
ForeColor="AliceBlue"
>
</asp:TextBox>
<br />
<asp:Button
ID="Button1"
runat="server"
Font-Bold="true"
ForeColor="SeaGreen"
Text="Find Inactive Profiles"
OnClick="Button1_Click"
/>
</div>
</form>
</body>
</html>

How to enable disable theme in Calendar, EnableTheming property

CalendarEnableTheming.aspx
<%@ Page Language="C#" Theme="CalendarThemeDisableTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to enable disable theme in Calendar, EnableTheming
property</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Navy; font-style:italic;">Calendar Example:
EnableTheming</h2>
<table cellpadding="5">
<tr>
<td>
<asp:Calendar
ID="Calendar1"
runat="server"
EnableTheming="true"
>
</asp:Calendar>
</td>
<td>
<asp:Calendar
ID="Calendar2"
runat="server"
EnableTheming="false"
>
</asp:Calendar>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

CalendarThemeDisableTest.skin
<asp:Calendar
runat="server"
BackColor="Pink"
ForeColor="Crimson"
BorderWidth="2"
BorderColor="SaddleBrown"
>
<TitleStyle BackColor="SaddleBrown" ForeColor="Snow" Font-
Bold="true" />
<DayHeaderStyle BackColor="Crimson" ForeColor="FloralWhite" />
<OtherMonthDayStyle BackColor="BurlyWood" />
<TodayDayStyle BackColor="PeachPuff" />
<NextPrevStyle ForeColor="Snow" />
<DayStyle Font-Italic="true" Font-Bold="true" />
</asp:Calendar>

How to use theme and skin in Calendar control

CalendarTheme.aspx
<%@ Page Language="C#" Theme="Calendar" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to use theme and skin in Calendar control</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Navy; font-style:italic;">Calendar Example:
Theme and Skin</h2>
<asp:Calendar
ID="Calendar1"
runat="server"
>
</asp:Calendar>
</div>
</form>
</body>
</html>

Calendar.skin
<asp:Calendar
runat="server"
BackColor="SandyBrown"
ForeColor="FloralWhite"
BorderWidth="4"
BorderColor="SaddleBrown"
>
<TitleStyle BackColor="Crimson" ForeColor="Snow" Font-Bold="true" />
<DayHeaderStyle BackColor="IndianRed" />
<OtherMonthDayStyle BackColor="PaleVioletRed" />
<TodayDayStyle BackColor="OrangeRed" />
</asp:Calendar>

You might also like