title: Add script on Page load c#
body: <p>I'm trying to add a script to the page but nothing happens, the calendar does not appear.
  The objective is to render a calendar with a list of events, im trying to avoid webservices to get the list. </p>
  
  <pre><code>  string CalendarScript = @"&lt;script type=""text/javascript""&gt;
          jQuery(function ($) {
  
              /* initialize the external events
                  -----------------------------------------------------------------*/
  
              $('#external-events div.external-event').each(function () {
  
                  // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
                  // it doesn't need to have a start or end
                  var eventObject = {
                      title: $.trim($(this).text()) // use the element's text as the event title
                  };
  
                  // store the Event Object in the DOM element so we can get to it later
                  $(this).data('eventObject', eventObject);
  
                  // make the event draggable using jQuery UI
                  $(this).draggable({
                      zIndex: 999,
                      revert: true,      // will cause the event to go back to its
                      revertDuration: 0  //  original position after the drag
                  });
  
              });
  
              /* initialize the calendar
              -----------------------------------------------------------------*/
  
              var date = new Date();
              var d = date.getDate();
              var m = date.getMonth();
              var y = date.getFullYear();
  
  
              var calendar = $('#calendar').fullCalendar({
                  lang: ""pt"",
                  allDaySlot: false,
                  minTime: ""07:00:00"", 
                  maxTime: ""23:59:59"",
  
                  defaultView: 'agendaWeek',
  
                  header: {
                      left: ' ',
                      center: ' ',
                      right: ' '
                  },
                  events: [ " + EventsList + @"
                  ]
      ,
  
                  columnFormat: {
  
                      week: 'dddd', 
  
                  },
  
                  editable: false,
                  droppable: false, // this allows things to be dropped onto the calendar !!!
  
                  selectable: false,
                  selectHelper: false
  
  
              });
  
  
          })
      &lt;/script&gt;";
          ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "InitCalendarEvents", CalendarScript, false);
  </code></pre>
  
  <p>where the EventList is like this</p>
  
  <pre><code>   { title: 'Some Event', start: new Date(y, m, d - 2, 16, 00), end: new Date(y, m, d - 2, 17, 00), allDay: false,  color: 'blue !important',  textColor: 'white !important' }
  </code></pre>