My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1825: Cannot didplay events from db
1 person starred this issue and may be notified of changes. Back to list
Status:  Invalid
Owner:  ----
Closed:  Aug 2013


Sign in to add a comment
 
Reported by animesh....@gmail.com, May 7, 2013
I used this:

            $(document).ready(function () {
                calresult();
             });
function calrest() {

            $('#fullcal').fullCalendar({
                eventClick: function() {
                    alert('a day has been clicked!');
                },
                events: function(start, end, callback) {
                    alert(document.getElementById('<%=hdClientID.ClientID %>').value);
                    $.ajax({
                        type: "POST",    //WebMethods will not allow GET
                        url: "test2.aspx/GetEvents",   //url of a webmethod - example below
                        data: "{'ClientID':'" + document.getElementById('<%=hdClientID.ClientID %>').value + "'}",  //this is what I use to pass who's calendar it is 
                        //completely take out 'data:' line if you don't want to pass to webmethod - Important to also change webmethod to not accept any parameters 
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function(doc) {

                            var events = [];   //javascript event object created here
                            var obj = $.parseJSON(doc.d); //.net returns json wrapped in "d"

                            $(obj.event).each(function() { //yours is obj.calevent                          
                                events.push({
                                    title: this.Title,
                                    start: new Date(this.StartDate),
                                    end: new Date(this.EndDate)
                                });
                            });
                            callback(events);

                        },

                        error: function(jqXHR, textStatus, errorThrown) {
                            alert(jqXHR.responseText);
                        }
                    });

                }
            });

        }

[WebMethod(EnableSession = true)]
        public static string GetEvents(string ClientID)
        {
            ClsEvent _objEvent = new ClsEvent();
            DataTable dt = new DataTable();
            dt = _objEvent.GetAllEventbyClientID(Convert.ToInt32(ClientID));
            List<Events2> lists = new List<Events2>();
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    var evt = new Events2();
                    evt.Id = Convert.ToInt32(dr["ID"]);
                    evt.Title = Convert.ToString(dr["EventName"]);
                    evt.StartDate = converttotime(Convert.ToDateTime(dr["HoldThroughfrom"]));
                    evt.EndDate = converttotime(Convert.ToDateTime(dr["HoldThroughTo"]));
                    lists.Add(evt);
                }
            }


            //List<Events> eventList = GetAllEvent(ClientID);

            // Select events and return datetime as sortable XML Schema style.
            var events = from ev in lists
                         select new
                         {
                             id = ev.Id,
                             title = ev.Title,
                             start = ev.StartDate,
                             end = ev.EndDate
                         };

            // Serialize to JSON string.
            JavaScriptSerializer jss = new JavaScriptSerializer();
            String json = jss.Serialize(events);
            return json;
        }

        private static long converttotime(DateTime value)
        {
            long epoch = (value.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
            return epoch;
        }
  public class Events2
    {
        public int Id { get; set; }
        public string Title { get; set; }
        public long StartDate { get; set; }
        public long EndDate { get; set; }
    }

Data that are coming from db are correct just could not populate or show them in the calender.



Aug 24, 2013
Project Member #1 adamrs...@gmail.com
(No comment was entered for this change.)
Status: ReproTemp
Aug 25, 2013
Project Member #2 adamrs...@gmail.com
This message is being bulk-sent to a number of issues, both [very] old and new.

I have been working on taming this issue tracker, which has gotten out of control after months of neglect. You are receiving this message because I could not successfully reproduce the bug you were reporting with a reasonable amount of effort. I have written some new bug-report guidelines to be used by all bug reports going forward:

    http://arshaw.com/fullcalendar/wiki/Report-a-Bug/

Its salient point is that all bug reports should have an isolated demonstration, viewable online with a tool like JSFiddle.

If the bug you originally reported is still important to you, could you please first try the latest version of FullCalendar and see if it is fixed? If not, could you please file a NEW bug report that follows the new guidelines? This issue will not be monitored for further comments.

I'm sorry I have taken so long to respond to many of your request, and I'm sorry if this new procedure causes extra work for you. Going forward, the issue tracker will be much more of a well-oiled machine.

Again, if you must, PLEASE SUBMIT A *NEW* BUG REPORT (following the new guidelines) INSTEAD OF COMMENTING ON THIS ONE. Further comments on this report will be ignored. Thanks.
Status: Invalid
Labels: Type-Bug
Sign in to add a comment

Powered by Google Project Hosting