webformstelerikradgrid

Telerik RadGrid showing GridExpandColumn with list of domain entities


I am using a Telerik RadGrid to display a list of domain entities. A column is implicitly being added (no column header, shows twisty/arrow icon that does nothing).

screen shot of grid columns

I believe this column is a "GridExpandColumn"

Telerik.Web.UI.GridExpandColumn This column appears when the grid has a hierarchical structure, to facilitate the expand/collapse functionality. The expand column is always placed in front of all other grid content columns and can not be moved.

My entities do contain one property that is a collection, but it's not something I would ever want to show as a detail view.

Through experimentation I have been able to determine that if I don't call radGrid.DataBind() after setting radGrid.DataSource, the column isn't shown.

Does anyone (a) know where/if this is documented and (b) is there another way (other than creating a DTO of the desired properties without any collections, or removing the column explicitly in the code behind) to prevent it from being created? I have AutoGenerateColumns="false" and the columns list in the aspx page are a mix of GridTemplateColumn and GridBoundColumn columns).

One extra funny bit: My application is actually two applications, one c# and one vb, the vb.net application doesn't have the same problem with the extra column, despite calling radGrid.DataBind() immediately after setting the datasource. At least on some pages, so it might not be a language difference but instead some other usage that I haven't figured out.


Solution

  • I don't know why the DataBind() makes a difference, but I have found a way to explicitly control whether that column is visible or not.

    The MasterTableView should be: <MasterTableView ExpandCollapseColumn-Visible="False">