PDA

View Full Version : [CLOSED] Add event from directevent in CalendarPanel



osef
Oct 04, 2013, 6:06 PM

Baidaly
Oct 04, 2013, 11:51 PM
Hello!

Couldn't reproduce. Do you see any error in the console?

osef
Oct 05, 2013, 3:58 PM

Baidaly
Oct 05, 2013, 10:37 PM
Try to use Store's Add method:


cpAgenda.EventStore.Add(emPrueba);

osef
Oct 05, 2013, 11:38 PM
Try to use Store's Add method:


cpAgenda.EventStore.Add(emPrueba);



This is not working Baidaly, It is not painting the event.

Baidaly
Oct 07, 2013, 4:40 AM
Try the following:


protected void cpAgenda_DayClick(object sender, DirectEventArgs e)
{
DateTime dt = new DateTime(2013, 10, 07, 1, 0, 0);
EventModel emPrueba = new EventModel();
emPrueba.EventId = 1001;
emPrueba.Title = "Titulo prueba";
emPrueba.StartDate = dt;
emPrueba.EndDate = dt.AddHours(2);
emPrueba.Notes = "Esto es una prueba de notas";
emPrueba.CalendarId = 1;

cpAgenda.EventStore.Add(emPrueba);
cpAgenda.EventStore.DataBind();
}

Daniil
Oct 07, 2013, 5:09 AM
I think you should apply some CalendarId.

emPrueba.CalendarId = 1;

osef
Oct 07, 2013, 9:54 PM
I think you should apply some CalendarId.

emPrueba.CalendarId = 1;

Daniil the problem is my CalendarId, this is working thank you, but now, When I get a click again, It is not painting again, I only to test I use EventId with DateTime.Now.Second, the object it's good, but "cpAgenda.EventStore.Events.Count" is zero the second clic, I don't know if this es the problem or what is?

Baidaly
Oct 08, 2013, 1:15 AM
I don't see any problems. Can you say the steps to reproduce?

I used the following code to add:


protected void cpAgenda_DayClick(object sender, DirectEventArgs e)
{
DateTime dt = new DateTime(2013, 10, 07, 1, 0, 0);
EventModel emPrueba = new EventModel();
emPrueba.EventId = DateTime.Now.Second;
emPrueba.CalendarId = 1;
emPrueba.Title = "Titulo prueba";
emPrueba.StartDate = Convert.ToDateTime(e.ExtraParams["StartDate"]);
emPrueba.EndDate = Convert.ToDateTime(e.ExtraParams["StartDate"]).AddHours(2);
emPrueba.Notes = "Esto es una prueba de notas";

cpAgenda.EventStore.Add(emPrueba);
}

Daniil
Oct 08, 2013, 3:51 AM
but "cpAgenda.EventStore.Events.Count" is zero the second click

An EventStore's Add method doesn't add an event into its Events collection. Moreover, the Events collection is not maintained during DirectEvents. It is only used to bind initial events.

osef
Oct 08, 2013, 8:55 PM
An EventStore's Add method doesn't add an event into its Events collection. Moreover, the Events collection is not maintained during DirectEvents. It is only used to bind initial events.

Hi Daniil and Baidaly, this is working, thank you for your help, my error is



cpAgenda.EventStore.Events.Add(emPrueba);


But with



cpAgenda.EventStore.Add(emPrueba);


It is working.