Print Page | Close Window

How to set DataSourceUpdateMode on ViewDescriptor

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=134
Printed Date: 19-May-2025 at 9:27am


Topic: How to set DataSourceUpdateMode on ViewDescriptor
Posted By: Customer
Subject: How to set DataSourceUpdateMode on ViewDescriptor
Date Posted: 12-Jul-2007 at 10:36am
How would I go about changing the DataSourceUpdateMode when I use AddGroup with a ViewDescriptor.  I want the DataSourceUpdateMode to be
OnPropertyChanged.

I have a panel control housing two radio buttons  I am binding a value to see if a Patient has done agricultralwork (for government reporting)
With a ControlBindingDescriptor I would just set the UpdateMode in the CBD's definition.  Here's my code below.  Any thoughts?

        rbAgriWorkNo.Tag = False
        rbAgriWorkYes.Tag = True
        Dim AgriWorkVD As ViewDescriptor = New ViewDescriptor(EntityPropertyDescriptors.Patient.UDSAgriWork)
        PatientCBM.Descriptors.AddGroup(Me.pnlAgriWork, AgriWorkVD)



Replies:
Posted By: IdeaBlade
Date Posted: 12-Jul-2007 at 10:37am

Since Descriptors.AddGroup() doesn't return the descriptors you have to get a little creative.  You can do a Get for each radio button, and then set the DataSourceUpdateMode.  Something like this:

PatientCBM.Descriptors.Get(rbAgriWorkNo).DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged;
PatientCBM.Descriptors.Get(rbAgriWorkYes).DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged;




Print Page | Close Window