Note that there are some explanatory texts on larger screens.

plurals
  1. PODisabling a TextBox in C# .NET using CSLA
    text
    copied!<p>I am trying to disable a number of text boxes intended for displaying data (not edit) in one of my UserControls. However, for some reason I can not get the textBoxes to disable properly.</p> <p>I've set "ApplyAuthorization on readWriteAuthorization" to true and the textBoxes are databound to the correct properties.</p> <p>I've also added the following lines to the <code>CanWriteProperty</code> of my object:</p> <pre><code>if (propertyName == OpeningDateProperty.Name) return false; if (propertyName == ChangeDateProperty.Name) return false; if (propertyName == CloseDateProperty.Name) return false; return base.CanWriteProperty(propertyName); </code></pre> <p>I can't figure out what I'm doing wrong here. I've implemented pretty much the same thing recently in other UserControls without any problems...</p> <p>I am using Windows Forms in C# .NET (Visual Studio 2008)</p> <p><strong>EDIT:</strong> The code snippets and the properties are taken from my customer object. The date represent opening, last change and closure of the customer account. They are never supposed to be edited at all and in fact in the old sollution they are represented by textLabels, however we now want to use a text box and make the property's CanWriteProperty false.</p> <p>I realise that the information might be sort of scarce, but I am looking for what I might have forgotten in this process.</p> <p><strong>EDIT:</strong> We are using <strong><em>CSLA</em></strong> as well and I guess (I'm new at this whole thing) this has something to do with why we want to do it like this.</p> <p><strong>EDIT (Sollution):</strong> As you can see in my answer below, the problem was that I had not set up the <code>CurrentItemChanged</code> event like I should have.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload