Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
330
Appointment Dialog swallows data (WINSCHEDULE DATABASE DEMO VB)
posted

I am playing with your WINSCHEDULE DATABASE DEMO VB, trying to get it to integrate with my app. The main thing I need is to change the database structure of the demo to include a link to the rest of my data. Ideally for me this would be an integer ID, but I see that the Infragistic schema includes a string DataKey field that appears to be made for this purpose, and I can live with that.

I have modified the program and the database so it accepts the new DataKey field without causing an error. The issue is that when I send the DataKey to the appointment, it gets swallowed and doesn't come back or get written to the database.

In ultraCalendarInfo1_BeforeDisplayAppointmentDialog I am setting DataKey to a dummy value for testing:

e.Appointment.DataKey = "98765"

However, when I created a ultraCalendarInfo1_AfterCloseAppointmentDialog event and look at e.Appointment.DataKey it is empty.

  • 330
    Offline posted in reply to Mike Saltzman

    Thanks for the reply. I'm really struggling here trying to integrate these samples into my code. Two points:
    1) I think Tag is thrown away too, not just DataKey (refer to 
     post above)
    2) In my app, I was planning on letting them make several appointments at a time. They will be looking at a grid of all the unscheduled assignments they have. They could then click on one or more and make appointments. I'm thinking that if we did it your way, in AfterAppointmentAdded, that if we had multiple instances it would be impossible to know which Tag to use. Not the end of the world I guess if we have to limit them to one appointment at a time. 

  • 469350
    Offline posted

    I did some experimenting here and I am seeing the same behavior. Any DataKey you apply to the Appointment in the BeforeDisplayAppointmentDialog is lost for new appointments.

    It looks like when you show this dialog, the Appointment in the BeforeDisplayAppointmentDialog is used to populate the dialog initially. So if you were to change the Appointment Subject, it shows that new subjects in the dialog. 

    When you show this dialog for an existing appointment, the Appointment you get in the BeforeDisplayAppointmentDialog is the same instance the dialog modifies. But when you show the dialog for a new appointment, the Appointment on the event args is thrown away and a new Appointment object is created by the dialog. And that new appointment is only populate with the fields the user can see on the dialog. Since the DataKey is not visible, it's lost. 

    We could fix this, I suppose, but frankly, I don't think BeforeDisplayAppointmentDialog is the appropriate place to set the DataKey. For one thing, the user could cancel the dialog and then you will have populate a DataKey for nothing. In your case, since you are using it as some kind of link to external data, that's not a big deal. But the primary purpose of the DataKey is to allow you to store some kind of ID to link that appointment up to a record in your data source. So in that case, it would not make sense. 

    Also, if the user show the dialog for an existing appointment, setting the DataKey in BeforeDisplayAppointmentDialog would also not be appropriate. 

    I think a much better solution for you would be to use the AfterAppointmentAdded. That event only fires for new appointments and only after the dialog is closed (and not cancelled). That would seem to solve all of the issues you are dealing with. 

  • 25665
    Offline posted

    Hello Ted,

    Thank you for contacting Infragistics Developer Support!

    The DataKey field is for setting a unique key for the appointment to be used in databinding. Instead, it is recommended you use the Tag field:

    www.infragistics.com/.../infragistics.win.ultrawinschedule~infragistics.win.ultrawinschedule.appointment~tag