Hi all,
i am Srinivas,
In my project i used Rad Calender Control for display a specific dates in a different formats, eg: i want to display a national holidays in a calender with LightSkyBlue color.
For the above example i used the following code in a Webpart.
in the above example it get's the data from the SharePoint List and shown in the RadCalender webpart with LightSkyBlue
color perfectly. but here the problem is when mouse over the calender webpart the color will not display's for the specific dates.
The Following Images are the examples for Before Mouse Over and After Mouse Over
Please help me,
Thanks
i am Srinivas,
In my project i used Rad Calender Control for display a specific dates in a different formats, eg: i want to display a national holidays in a calender with LightSkyBlue color.
For the above example i used the following code in a Webpart.
using
System;
using
System.ComponentModel;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
Microsoft.SharePoint;
using
Microsoft.SharePoint.WebControls;
using
System.Collections;
using
System.Data;
using
System.Drawing;
using
Telerik.Web.UI;
namespace
MyCalendar.MyLeaveCalender
{
[ToolboxItemAttribute(
false
)]
public
class
MyLeaveCalender : WebPart
{
private
IWebPartTable _provider;
private
ICollection _tableData;
private
ICollection _tableData1;
protected
RadCalendar CusCalender =
null
;
int
count = 1;
//[ConnectionConsumer("Holidays")]
[ConnectionConsumer(
"MyLeave"
, AllowsMultipleConnections =
true
)]
//[ConnectionConsumer("Filter", "UniqueFilterName", AllowsMultipleConnections = true)]
//public void GetConnectionInterface(IWebPartParameters pProvider) { }
public
void
GetConnectionInterface(IWebPartTable provider)
{
TableCallback callback =
new
TableCallback(ReceiveTable);
_provider = provider;
provider.GetTableData(callback);
}
public
MyLeaveCalender()
{
}
public
void
ReceiveTable(
object
providerTable)
{
_tableData = providerTable
as
ICollection;
}
protected
override
void
CreateChildControls()
{
base
.CreateChildControls();
CusCalender =
new
RadCalendar();
CusCalender.Width = 400;
CusCalender.Height = 200;
CusCalender.SelectedDate = DateTime.Now;
CusCalender.DayRender +=
new
Telerik.Web.UI.Calendar.DayRenderEventHandler(CusCalender_DayRender);
Controls.Add(CusCalender);
}
protected
void
CusCalender_DayRender(
object
sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
{
#region Holiday Calender
if
(e.Day.IsToday)
{
e.Cell.ToolTip =
"ToDay"
;
e.Cell.BorderWidth = 2;
}
try
{
if
(_tableData !=
null
)
{
foreach
(DataRowView rowView
in
_tableData)
{
// string widgetCode = rowView.Row[2].ToString();
string
status = rowView.Row[6].ToString();
DateTime startdate = Convert.ToDateTime(rowView.Row[3].ToString());
if
((startdate.Date == e.Day.Date.Date) && (status.ToString() ==
"Accept"
))
{
// e.Cell.BackColor = Color.LightSkyBlue;
//e.Cell.ToolTip = widgetCode;
//String url = e.SelectUrl;
e.Cell.Controls.Clear();
HyperLink link =
new
HyperLink();
link.Text = e.Day.Date.Day.ToString();
int
j = 1;
link.ToolTip =
"Leave Accepted List"
;
foreach
(DataRowView rowView1
in
_tableData)
{
DateTime startdates = Convert.ToDateTime(rowView1.Row[3].ToString());
DateTime enddate = Convert.ToDateTime(rowView1.Row[4].ToString());
string
statuss = rowView1.Row[6].ToString();
if
((startdates.Date == e.Day.Date.Date) && (statuss.ToString() ==
"Accept"
))
{
CusCalender.SelectedDates.SelectRange(startdates, enddate);
CusCalender.SelectedDayStyle.BackColor = Color.LightSkyBlue;
e.Cell.BackColor = Color.LightSkyBlue;
statuss =
""
;
link.ToolTip = link.ToolTip +
"\n"
+ j +
". "
+ System.Text.RegularExpressions.Regex.Replace(rowView1.Row[5].ToString(), @
"<(.|\n)*?>"
,
string
.Empty) +
" By "
+ rowView1.Row[2].ToString();
j++;
}
}
//link.NavigateUrl = url;
e.Cell.Controls.Add(link);
}
}
}
}
catch
(Exception ex)
{
}
}
}
}
in the above example it get's the data from the SharePoint List and shown in the RadCalender webpart with LightSkyBlue
color perfectly. but here the problem is when mouse over the calender webpart the color will not display's for the specific dates.
The Following Images are the examples for Before Mouse Over and After Mouse Over
Please help me,
Thanks