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

DataBind Error

Asked by Jason
12 years ago.

I am testing the control for our university and ran into a problem.

I am using C# and .Net 2.0.

Looking at the documentation it looks as if we are supposed to set the column name properties. This is my code.

DayPilotCalendar1.DataSource = dsReservations;
DayPilotCalendar1.DataTextField = dsReservations.space_reservation.act_head_countColumn.ColumnName;
DayPilotCalendar1.DataStartField = dsReservations.space_reservation.reservation_start_dtColumn.ColumnName;
DayPilotCalendar1.DataEndField = dsReservations.space_reservation.reservation_end_dtColumn.ColumnName;
DayPilotCalendar1.DataValueField = dsReservations.space_reservation.reservation_idColumn.ColumnName;
DayPilotCalendar1.DataBind();

I recieve an error when I try to DataBind() the control to the calendar. The error I recieve is "DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'reservation_start_dt'.".

Any suggestions would be most helpful.
Thanks,
Jason

Comment posted by Dan Letecky
12 years ago.
If you assign a DataSet to DataSource property, DayPilot will try to load the data from its first DataTable (Tables[0]). You can try assigning dsReservations.space_reservation to DataSource property if dsReservations contains more tables.
Comment posted by Jason
12 years ago.

Thanks Dan! Your suggestion worked. Just before I read your post I tried the following, which also worked.

DayPilotCalendar1.DataMember = "space_reservation";

My question now is, how can I display data from more than one table in my dataset? I have space data in one table with event data in another table and I would like to display a combination of both to the calendar control.

Thanks,
Jason

Comment posted by Dan Letecky
12 years ago.
OK, What does it mean, "space data"? Do you mean the table with resources (like people, meeting rooms to which the events are assigned)?

If so, these must be filled manually, using DayPilotCalendar.Columns.Add(new Column("name", "id"));
Comment posted by Jason
12 years ago.

Sorry Dan, bad use of "space data". My resource information, aside from the actual space, is in a different DataSet.

I will try again. I have a DataSet, with 4 tables, which populatevia a webservice from our scheduling database. Currently, I am only pulling event/reservation data for 1 space. (Later I will add more spaces and be interested in the resource view.) One Event can have multiple Reservations and the Reservations can be in multiple Spaces. Example: A Food Toxicology conference is one event but it would have multiple reservations for break out sessions.

The tables in the dataset are SPACE_RESERVATION(parent), SPACE_RESERVATIONS, SPACES, EVENT.
EVENT = this includes the event_name, event_title, event_type, event_start_dt, event_end_dt........etc.
SPACE_RESERVATIONS = all possible occurances of the event and includes reservation_start, reservation_end....etc.
SPACES = The space the reservation/occurance is happening in

Ihave set the DataMember to SPACE_RESERVATIONS and the reservation_start and reservation_end display on the calendar control fine after your last suggestion. However, I also need the event_title from the EVENT table in the DataSet to display in the DayPilotCalendar.DataTextField for each reservation.(I am currently using head count from the space_reservations table to meet the required field)

I hope this makes more sense. I just need to grab the title which is another table other than the table I set as the DataMember.

Thank you very much for your assistance.
Jason

Comment posted by Dan Letecky
12 years ago.
If I understand it correctly, each space_reservations is linked to exactly one event and exactly one spaces.

If that's the case, spaces would correspond to resources in DayPilot terminology. You would either select space_reservations for a single space (in Days view) or for multiple spaces (in Resources view). In the latter case, you would use the space table to fill the Resources collection.

What you need to do is to join the event table with space_reservation in the SELECT SQL command, something like this:

SELECT space_reservations.reservation_start, space_reservations.reservation_end, space_reservations.id, event.name FROM space_reservations JOIN event ON space_reservations.event_id = event.id

I hope it's more clear now. If it's not, let me know what I should clarify.
This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.