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
80
Databinding with UltraCalendarInfo not working properly
posted

Hi everyone,

I recently downloaded NetAdvantage 2011.1. I'm trying to bind a SQL Server Table to a Ultracalendarinfo control, that then is associated to a WinGanttViewControl.

This is the structure of the DB Table:

TABLE [dbo].[PROJECTS](
 [ID] [varchar](6) NOT NULL,
 [IDX] [uniqueidentifier] NULL,
 [DESCRIPTION] [varchar](50) NOT NULL,
 [STARTDATE] [datetime] NOT NULL,
 [FINISHDATE] [datetime] NULL,
 [SERIAL] [varbinary](1024) NULL)

 

Users can select many projects at a time, so I use a bindingsource called BS1 to load projects data. When application starts, a dataset with empty tables is created and it's set as datasource for the bindingsource. The dataset is compiled once the user select one or more projects to load.

This bindingsource is used as the datasource for the UltraCalendarInfo control.

 

So, once the bindingsource is defined I set up the databinding as follow :

            With UltraCalendarInfo1.DataBindingsForProjects
               .SetDataBinding(bs1, "")
               .BindingContextControl = Me

               .IdMember = "IDX"
               .KeyMember = "ID"
               .NameMember = "DESCRIPTION"

               .StartDateMember = "STARTDATE"
               .AllPropertiesMember = "SERIAL"
            End With

 

But there's something wrong with it: if I catch the event UltraCalendarInfo.ProjectDataInitialized and look at the property Project of the event e, it's not the Project I loaded, but just a new one with default values. But if I look at the property BindingListObject of the event e, I find the correct row of the loaded project. It seems that there's something that break up on the databinding process...

Private Sub UltraCalendarInfo1_ProjectDataInitialized(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.ProjectDataInitializedEventArgs) Handles UltraCalendarInfo1.ProjectDataInitialized

'---Here Project.Key has not the correct value but a new GUID value: I set up properties from the BindingListObject


      e.Project.Key = e.Project.BindingListObject("ID")
      e.Project.Name = e.Project.BindingListObject("DESCRIPTION")
      e.Project.StartDate = e.Project.BindingListObject("STARTDATE")

   End Sub

Can anyone help me?

 

Thanks so much.

Stefano

Parents
  • 69832
    Offline posted

    Data binding issues are extremely difficult to speculate about without a sample project to refer to, but I think what happens is, since you have the AllPropertiesMember mapped, the ProjectDataInitialized event fires upon creation of the Project instance, and if the field (to which the AllPropertiesMember is bound) contains no data, the state of the Project instance at the time the event is fired would be consistent with what you are observing.

    I see that you also have the KeyMember property set, so assuming the bound value is valid, the project probably assigns that value to the Key property in due course, i.e., when the property is first requested. You could confirm whether this is the case by checking the Projects collection after the binding is complete.

Reply Children
No Data