Print Page | Close Window

Read only Property

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=344
Printed Date: 19-Oct-2025 at 8:37am


Topic: Read only Property
Posted By: Matthew
Subject: Read only Property
Date Posted: 31-Jul-2007 at 5:39pm
I'm having some trouble figuring out a few things about data binding and was hoping for some advice. 

Lets say I have two tabs, one to display the fields of my main object, and the other to display the fields of an object in a one-to-one relationship to my main object.  For example one tab for Customer info (name, address, etc) and another tab for Customer's boss info(name, title, etc)  exposed as Customer.Boss.

When I set this up with a ControlBindingManager, the Boss info is all Read-Only.  I would like to set this up so that I can edit the Boss info. 

Any suggestions as to where I should begin?





Replies:
Posted By: Matthew
Date Posted: 31-Jul-2007 at 9:27pm
Well, it appears that I really knew the answer to this, it was just well hidden under a few layers of frustration.  I used a couple of binding sources / managers to get the desired result.

Nothing to see here,
Matt


Posted By: Linguinut
Date Posted: 01-Aug-2007 at 9:23am
I know the frustration.
 
This is a good tech tip that relates to your situation: http://www.ideablade.com/techtip_Working_with_a_ReadOnlyEntityList.htm - http://www.ideablade.com/techtip_Working_with_a_ReadOnlyEntityList.htm .
 
Have you read that one?
Bill


Posted By: davidklitzke
Date Posted: 01-Aug-2007 at 10:15am

I know that you say that you came up with a solution for this, but you might consider this advice, Ward gave to a customer long ago who ran into a similar problem:

This is a great question and one that developers new to DevForce often ask.
 
Your problem is that you are binding to properties of a related object.  It's true that you have done nothing to make these properties readonly, but DevForce makes access to these  properties readonly by default - for the good reason that it is unusual to want to change the value of a related object through an interface looking at the original object. Thus, while looking at an Employee, we could look at her address but we would typically change her address by popping up a dialog for that purpose or, perhaps, reserving real estate on the screen for that purpose. 
 
In addition, if you make a related  property editable, it can be confusing what the edit means.  For example, let us say that an employee's manager's name is "Nancy Davolio" and a user changes it to "Nancy Smith".  Does the employee have a new manager, or has Nancy's last name changed because she married Bob Smith.
 
If you really insist on editing a related poperty, you can set the editability of the control to "Optional".  This works, but before you go ahead and do this, ask yourself whether this is the best way to edit this related property.



Print Page | Close Window