13.07.2015 Views

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 10: Rich Data Controls 255TitleFormat="Month" Width="800px" OnDayRender="CheckAppts">When adding the C# code, pay special attention to the switch statement. Oftenswitch statements are used with arrays to filter out a single element, but here all ofthe days of the week are available when the calendar is rendered. The switch statementmerely helps place the required materials. The break statements, while required forthe switch structure, really are unnecessary. The switch does not break when itencounters the first true value in a case, but goes through the entire list, gets all of theinstances, and places them in the calendar.C# CalMind.aspx.csusing System;using System.Web.UI.WebControls;public partial class CalAppt : System.Web.UI.Page{private string dow;private string appt;private string soccer;private string ballet;private string baseball;protected void CheckApps(object sender, DayRenderEventArgs e){appt = "Drive to:";soccer = appt + "Soccer practice";ballet = appt + "Ballet lessons";baseball = appt + "Mom's baseball";dow=(e.Day.Date.DayOfWeek).ToString();(continued)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!