Я использую полный календарь, в котором данные выбираются из базы данных с цветом фона и шрифта. ![enter image description here](https://i.stack.imgur.com/06ctO.png)
Теперь, как вы можете видеть на изображении, когда выбран месяц, данные отображаются на основе BGColour And Font Color, но , когда я нажимаю на WEEK CSS не работает. Пожалуйста, помогите.
public static List<CalendarEvent> getEvents(DateTime start, DateTime end)
{
List<CalendarEvent> events = new List<CalendarEvent>();
SqlConnection con = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand("SELECT E.event_id, E.description,E.title as reason, E.event_start, E.event_end, E.UserID, (hp.Fname + ' ' + hp.Lname) as title,isnull(mpres.AppReasonBGColour,'') as BGC, isnull(mpres.AppReasonFontColor,'') as RFC FROM event E inner join h_pat hp on hp.patid = E.patid left join m_appointmentreason mpres on E.title = mpres.AppReasonName where E.stats_flag<> 'D' order by E.modify_dt desc", con);
TimeZone zone = TimeZone.CurrentTimeZone;
using (con)
{
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
CalendarEvent cevent = new CalendarEvent();
cevent.id = (string)reader["event_id"];
cevent.title = (string)reader["title"];
cevent.fontColour = (string)reader["RFC"];
cevent.BGColour = (string)reader["BGC"];
//cevent.description = (string)reader["description"];
cevent.start = zone.ToLocalTime(Convert.ToDateTime(reader["event_start"]));
cevent.end = zone.ToLocalTime(Convert.ToDateTime(reader["event_end"]));
events.Add(cevent);
}
}
return events;
}
Вот мой код страницы aspx, с которого начал работать мой календарь
$('#<%=calendar.ClientID%>').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
buttonText: {
today: 'today',
month: 'month',
week: 'week',
day: 'day'
},
allDaySlot: false,
slotDuration: '00:30:00',
//Random default events
events: "/Scheduler/JsonResponse.ashx",
editable: false,
droppable: false, // this allows things to be dropped onto the calendar !!!
});
Мой код страницы JsonResponse.ashx
public class JsonResponse : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
DateTime start = Convert.ToDateTime(context.Request.QueryString["start"]);
DateTime end = Convert.ToDateTime(context.Request.QueryString["end"]);
List<CalendarEvent> userList = new List<CalendarEvent>();
foreach (CalendarEvent cevent in EventDAO.getEvents(start, end))
{
userList.Add(cevent);
}
context.Session["idList"] = userList;
System.Web.Script.Serialization.JavaScriptSerializer jSearializer =
new System.Web.Script.Serialization.JavaScriptSerializer();
context.Response.Write(jSearializer.Serialize(userList));
}
Вот мой Fullcalender. js код файла
return '<a style="background-color:#' + htmlEscape(event.BGColour) + ';color:#' + htmlEscape(event.fontColour)+'" class="' + classes.join(' ') + '"' +
(event.url ?
' href="' + htmlEscape(event.url) + '"' :
''
) +
(skinCss ?
' style="' + skinCss + '"' :
''
) +
'>' +
'<div class="fc-content">' +
(this.isRTL ?
titleHtml + ' ' + timeHtml : // put a natural space in between
timeHtml + ' ' + titleHtml //
) +
'</div>' +
(isResizable ?
'<div class="fc-resizer"/>' :
''
) +
'</a>';
Здесь я пытаюсь применить код, но у меня ничего не работает.