search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Create an event/item without database reference.

Asked by David
17 years ago.
Hello everyone,

Im currently testing daypilot for usage in my internship project. As to now it works like a charm.
I'm only having one problem, I need to dynamically write an event without it being linked in the bound table.
This because it will be used to plan resources on an assignment, the assignments are located in another table but I need to show the startdate & deadline in an event.
Is there a way to draw events without any bind?

Thanks in advance, David.
Comment posted by Dan Letecky
17 years ago.
You can create the data source in memory (and store it in the Session, for example). But it can only load the data from a data source.

But I think I'm missing somewhere here. Usually it's the best way to load everything from a database. Where do you load the events from?
Comment posted by David
17 years ago.
Dear Dan,

First of all thanks for your quick reply.
I load the events from a mssql db in the table items. The assignment startdate & deadline are located in another table called Assignments. Because the assignments are able to be changed (shortened/moved) i cannot duplicate them in the item table. The items are loaded through an ObjectDataSource set as the Daypilot scheduler datasource, the source returns a datatable with the different items.
Because of this i wanted to know if I was able to create an event without it being in the datasource. Maybe you know another solution to my problem?

Thanks in advance,
David.
Comment posted by Dan Letecky
17 years ago.
David, I'm afraid I don't understand the relationship between the events and assignments. Can you give an example?

Usually, you should be able to create your SQL query to produce exactly the items that will be visible in the calendar. I still believe it's your case as well.
Comment posted by David
16 years ago.
Hello Dan,

Thank you for your response, please excuse me for my late reaction.
I was thinking to dificult creating the items without a reference. Ive fixed this by simply adding them to the bound datatable.

Gr David.
Comment posted by Dan Letecky
16 years ago.
OK.
Comment posted by Simon Edwards
16 years ago.

The original Question is still a valid one I think - how can Events be manually added to an 'unbound'calendar programatically?

My reason for wanting to do this is that I have several lists of 'All Day' Events which are stored against a particular 'contract reference'. I want to be able to choose which 'contracts' I want to display theevents for, then itterate through the chosen contracts, adding in all the events. Each list of events is a separate ArrayList (actually an IList<Type> from nHibernate) - but I can only 'bind' to one ArrayList at a time.

I'm currently evaluating the DayPilotMonth control (month view), and it is this that I really want to be able to use, as it seems so much better than say C1's offering, but I really need something like the ability to do this....

DayPilotMonth1.Events.Add(new DayPilotEvent(......));

...otherwise, I'm faced with altering my business object model, so NH can return a single data structure, to cope with the limitations of the GUI tier, which doesn't sound like the best way to be going to me.

Any Help always Appreciated.

Regards
Simon
mailto:coding(REMOVEME)@controlbox(ANDME).co.(ANDMETOO)uk

Comment posted by Dan Letecky
16 years ago.
Well, technically I don't see a big difference between these two schemes:
List<YourEvent> list = new List<YourEvent>();
foreach (Item item in YourDataSource) {
YourEvent e = new YourEvent(item.Start, item.End, ...);
list.Add(e);
}
DayPilotMonth1.DataSource = list;
DayPilotMonth1.DataBind();
and
foreach (Item item in YourDataSource) {
Event e = new Event(item.Start, item.End, ...);
DayPilotMonth1.Items.Add(e);
}
But it seems that you are not the only one who prefers the second option. ;-)

The collection of events (Items from the example above) is maintained internally anyway (it's being filled during the DataBind). It won't be a big problem to allow direct access to the collection. Just remember that you will have to fill DayPilot's Event class (internal at this moment) anyway so it doesn't save you so much work.

I hope it could be available in the next release (4.6), at least for DayPilotMonth as an experiment.

And thank you for spending the time with your post, such discussions help DayPilot be better.
Comment posted by robert mccabe (robert.mccabe@northgate-is.com)
14 years ago.
Hi, I am also evaluating daypilot and im interested in the Calendar control. I have a number of questions. How can I get the control to show 5 days (instead of the default 1 day). Also, I have my own data to bind. I am currently working with the test xml file. I want to (in code), add a dataset of my own definition to the calendar. How can i do this. I was trying something like this: private void ConfigureTimetable(DayPilot.Web.Ui.DayPilotCalendar Cal, DateTime StartDate, DataSet XMLData) { Cal.StartDate = StartDate; Cal.DataStartField = "Start"; Cal.DataEndField = "End"; Cal.DataTextField = "Name"; Cal.DataValueField = "Name"; Cal.DataSource = XMLData; Cal.DataBind(); } In this example, the data set is just made up of the same data in the test xml file but this still doesnt render for me. Thanks in advance! Robert
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.