Infragistics Databinding

Infragistics Databinding

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


yuhnkee posted on Wednesday, July 18, 2007

Has anybody bound an Infragistics grid to an object with properties that do a role check?  For some reason, the grid generates columns for every property in my object even at runtime.   Not only will It access all of the properties when they are not all needed but an exception is thrown when a user doesn't have access to a specific property (I throw exceptions when a CanGetObject fails).

SonOfPirate replied on Wednesday, July 18, 2007

If you are allowing the grid to auto-generate columns for you, it will create a column for all of your public properties unless you mark them with the System.ComponentModel.BrowsableAttribute set to false.  However, if you are having problems with authorization in your properties, you will have to turn off AutoGenerateColumns and manually define which columns your user is allowed to view.  If you are trying to use the same grid for multiple users/roles, you will want to add code that calls the data source BO's CanReadProperty(propertyName) method for each property, adding or removing the column based on the returned value.

HTH

 

yuhnkee replied on Thursday, July 26, 2007

How do you turn off AutoGenerateColumns in an Infragistics grid? 

Dawn replied on Saturday, July 28, 2007

Design your layout in visual stdio designer.
Call
grid.SetDataBinding(yourDataSource, yourDataMember, true, true);

first true hide new column, second true hide new band.

pelinville replied on Saturday, July 28, 2007

There is another property  called ShowOnlyPredefinedDetails that can also bite you.

If it is set to "False"  it will walk the child object exposed as properties.  This can also cause problems like you describe even if the columns are set in design time.

 

EDITED changed "True" to "False".  You want it to be "True" if you don't want the grid to bind to child collections.

Copyright (c) Marimer LLC