Calendar Control
i have using calendar control i want to display selected particular date as red in color using c#(asp.net) with example.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Feb 5, 2012, 10:37 AM
Create your own app and add the code inside
Default.aspx.cs code
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.IsToday)
{
e.Cell.BackColor = Color.Red;
//e.Cell.ForeColor = Color.Red;
}
}
Thanks
karthik vPosted Feb 5, 2012, 10:17 AM
Posted Feb 5, 2012, 9:19 AM
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Calendar11._Default" %>
Satyapriya NayakPosted Feb 5, 2012, 7:57 AM
Try this...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Calender11._Default" %>
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;
using System.Drawing;
namespace Calender11
{
public partial class _Default : System.Web.UI.Page
{
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.IsToday)
{
e.Cell.BackColor = Color.Red;
//e.Cell.ForeColor = Color.Red;
}
}
}
}
Thanks