Authorization and DataGridViews

Authorization and DataGridViews

Old forum URL: forums.lhotka.net/forums/t/4495.aspx


sgraham posted on Thursday, March 13, 2008

I have a editable business base that has editable child objects of three different types.

Parent

   ChildTypeOneCollection

      ChildTypeOne

   ChildTypeTwoCollection

      ChildTypeTwo

   etc

They are all editable together on a single WinForm.

The base object uses standard controls (text boxes, combo boxes, check boxes, etc.).  The children are edtiable within a datagridviews on separate tab pages on the same form.

I am overriding the CanWriteProperty for some parent and child object properties that are only editable at certain times (based on data).

I'm using the read/write authorization control to update the controls automatically based on those overrides.

The contols for the parent properties that are not editable are disabled and don't allow the user to believe they can edit the field.

However, the datagridview that is bound to the child object DOES NOT disable the column in the grid (and doesn't even appear to "check" the editability of the child properties until AFTER the user enters data; at which point the business object returns the security exception that the field is read-only).

I realize that datagridviews need instantiated on all the tabpages before binding and I've done that.  Regardless, the initial tabpage that displays doesn't even appear to work properly.

Does anybody know what I'm missing as to why the datagridviews don't check the child property editability and disable them so the user isn't inclined to think they can edit the data?

Do I need separate read/write authorization controls for each child?  Does it have something to do with object and control instantiation timing?

Any help would be GREATLY appreciated!

RockfordLhotka replied on Thursday, March 13, 2008

The readwriteauthorization control only affects detail controls. You need to deal with complex controls (like grids, etc) in your own UI code.

sgraham replied on Thursday, November 20, 2008

 I'm still having this problem.  Does anybody have an suggestions or ideas?  I would apprecaite any and all help!

Copyright (c) Marimer LLC