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
654
WebObjectBase GetValue and SetValue
posted

Hello -

I've extended the appointment class to add some custom fields.  I followed the suggested implementation, using the WebObjectBase's GetValue and SetValue to store my new properties.  Can anyone tell me the benefit of this over having my own member variables?  I was hoping that this implementation would send my new properties to the UI in some way, so I can access the properties with client-side scripts. 

Thanks!

-Brian

Parents
No Data
Reply
  • 4960
    Verified Answer
    posted

    GetValue and SetValue methods are plumbing in the WebUI.Shared class library, their primary purpose is to help with viewstate handling of said property (ours, yours).  In WebSchedule, Appointments are not saved in viewstate, but if you wanted to save/restore them to viewstate using these methods they would help you to bring your properties with you using the Shared class library's plumbing to do it.

    Put another way, these methods have a relationship to the persistence of properties. WebSchedule (it is the only control/group of controls that does this) relies on them for its data binding (as it doesn't rely upon them for the object's viewstate management).  If you subclass one of the data provider base classes, and take several steps (talked about in another thread), then property values retrieved/stored using Get/SetValue enable the data provider base classes to automatically transport it back and forth to the database.

    You're right that it would be nice if these could send the custom properties to the client-side - but they do not at this time.

Children