attribute for not generating a column RRS feed

  • Question

  • I was hoping to use the new data annotation attributes to mark one of my properties (the primary key), as not visible.  So that the row isnt generated when AutoGenerateColumns is true on the datagrid/dataform.  Is this possible?  I know I can go in and manualy specify which columns are shown or not, but I would prefer to do this at the data level.

    Wednesday, April 8, 2009 7:59 PM


  • DataGrid supports a "Bindable" attribute which lets you specify which columns you wish to Autogenerate. This can be set at a class or property level. Here is a simple example:


    public string Primary_Key { get; set; }

    this will block Primary_Key from being Autogenerated.

    Gunjan Shah [MSFT]

    Thursday, April 9, 2009 5:16 PM

All replies