How to determine whether selected date is todaysdate or Weekend

Posted by Manideepgoud under ASP.NET category on | Points: 40 | Views : 1252
In order to define whether selected date is todays date or weekend using ASP.NET

In aspx page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Load.aspx.cs" Inherits="Load" %>

<!DOCTYPE html>
<html xmlns="">
<head runat="server">
<form id="form1" runat="server">
<asp:Calendar ID="calender1" runat="server" OnDayRender="Render">
<DayHeaderStyle BackColor="#99CCCC" ForeColor="green" Height="1px" />
<TitleStyle Backcolor="Red" ForeColor="Yellow"/>

In aspx.cs page

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Load : System.Web.UI.Page
protected void Render(Object Sender, DayRenderEventArgs e)
if (e.Day.IsToday)
e.Cell.Controls.Add(new LiteralControl("<p style=\"color:red;\">TodaysDate</p>"));
if (e.Day.IsWeekend)
e.Cell.Controls.Add(new LiteralControl("<p style=\"color:blue;\">Weekend</p>"));

Comments or Responses

Login to post response