0

I am using fullcalendar plugin -

//c#
 public JsonResult Events(int start, int end) // GetEvents return an array of my DTO
        {
            return Json(GetEvents(ConvertFromUnixTimestamp(start), ConvertFromUnixTimestamp(end)),  JsonRequestBehavior.AllowGet);
          }

//html
<head>
    <script type='text/javascript'>
       $(document).ready(function () {        
        $('#calendar').fullCalendar({
            header: {
                left: '',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            month: 5,
            year: 2011,
            editable: false,
            events: 'MyWebsite/Events'
        });
    });
</script>

The problem is the data is getting encoded, so I want to pass something like "<b>Name</b>" it gets encoded. So, I tried serializing with AllowHtml attribute but does not work also I have tried bunch of other things. What I need to do is somehow call serialize object without the encoding which I guess by default..or at least skip encoding for the one field with AllowHtml data annotation ? I have a looked at a similar problem.

Can anyone give me any help here I cannot really use Html.Raw() as I see it since I am passing the data to javascript I guess it just needs to be somehow decoded.

Community
  • 1
  • 1
Vishal
  • 12,133
  • 17
  • 82
  • 128

1 Answers1

0

For doing this you will have to edit the fullcalendar.min.js or the fullcalendar.js file whichever that you have included and search for

"<span class='fc-event-title'>" + Ka(Q.title) + "</span></a>"

then add bold tags as follows

"<span class='fc-event-title'><b>" + Ka(Q.title) + "</b></span></a>"
Pakauji Pakau
  • 49
  • 1
  • 8