Okay so I created the thems and the skins How do I create th
Okay so I created the thems and the skins. How do I create the calender portion?
Steps would be fine, not the actual code.
Step 1. Creating the Theme and Skins
Create a custom theme
Create a theme called Theme1 and Theme2.
Configure your web site to use the Theme1 theme
Use skins, stylesheets to configure your project\'s colors and design.
You will be graded on your ability to customize the theme to enhance the appearance of your web site.
Design a calendar using a skin
Create a web page called Calendar.aspx in your Pages folder.
Create a calendar.skin file in Theme1. In the file, create two calendar skins with very different appearances. Name one of the skins, MyCalendarSkin. Leave the other with no skin ID assigned.
Insert a calendar in the Calendar.aspx page. Configure the calendar to use the MyCalendarSkin skin.
Duplicate the skin files and place them in the Theme2 folder. Change the properties of the skins.
You will be graded on your ability to customize the calendar to match the rest of your web site.
Solution
Ans: The following code is for the calender i provided comments for better understanding.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Calendar : System.Web.UI.Page
{
public string controlToEdit;
public string isPostBack;
public Calendar()
{
LoadComplete += new EventHandler(Page_LoadComplete);
}
void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
controlToEdit = Request.QueryString[\"controlID\"];
Session.Add(\"controlToEdit\", controlToEdit);
isPostBack = Request.QueryString[\"isPostBack\"];
Session.Add(\"isPostBack\", isPostBack);
// Cast first day of week from web.config file. Set to calendar
//Cal.FirstDayOfWeek = (System.Web.UI.WebControls.FirstDayOfWeek)Convert.ToInt32(ConfigurationManager.AppSettings[\"FirstDayOfWeek\"]);
// Select Correct date for Calendar from query string
// If fails, pick the current date on Calendar
try
{
Cal.SelectedDate = Cal.VisibleDate = Convert.ToDateTime(lblDate.Text);
}
catch
{
Cal.SelectedDate = Cal.VisibleDate = DateTime.Today;
}
FillCalendarChoices();
SelectCorrectValues();
}
else
{
if (Session[\"controlToEdit\"] != null)
controlToEdit = (string)Session[\"controlToEdit\"];
if (Session[\"isPostBack\"] != null)
isPostBack = (string)Session[\"isPostBack\"];
}
}
void Page_LoadComplete(object sender, System.EventArgs e)
{
OKButton.OnClientClick = \"javascript:window.opener.SetControlValue(\'\" + this.controlToEdit + \"\',\'\" + lblDate.Text + \"\',\'\" + this.isPostBack + \"\');\";
}
protected void FillCalendarChoices()
{
DateTime thisdate = (DateTime.Now).AddYears(5);
//inputting Months
for (int x = 0; x < 12; x++) // 12 iterations as 12 months(loop)
{
ListItem li = new ListItem(thisdate.ToString(\"MMMM\"), thisdate.Month.ToString());
MonthSelect.Items.Add(li);
thisdate = thisdate.AddMonths(1);
}
// inputting years
for (int y = 1998; y <= thisdate.Year; y++)
{
YearSelect.Items.Add(y.ToString());
}
}
protected void SelectCorrectValues()
{
lblDate.Text = Cal.SelectedDate.ToShortDateString();
datechosen.Value = lblDate.Text;
MonthSelect.SelectedIndex = MonthSelect.Items.IndexOf(MonthSelect.Items.FindByValue(Cal.SelectedDate.Month.ToString()));
YearSelect.SelectedIndex = YearSelect.Items.IndexOf(YearSelect.Items.FindByValue(Cal.SelectedDate.Year.ToString()));
}
protected void Cal_SelectionChanged(object sender, System.EventArgs e)
{
Cal.VisibleDate = Cal.SelectedDate;
SelectCorrectValues();
}
protected void MonthSelect_SelectedIndexChanged(object sender, System.EventArgs e)
{
Cal.SelectedDate = Cal.VisibleDate
= new DateTime(Convert.ToInt32(YearSelect.SelectedItem.Value),
Convert.ToInt32(MonthSelect.SelectedItem.Value), 1); ;
SelectCorrectValues();
}
protected void YearSelect_SelectedIndexChanged(object sender, System.EventArgs e)
{
Cal.SelectedDate = Cal.VisibleDate
= new DateTime(Convert.ToInt32(YearSelect.SelectedItem.Value),
Convert.ToInt32(MonthSelect.SelectedItem.Value), 1); ;
SelectCorrectValues();
}
}




