This is a migrated thread and some comments may be shown as answers.

CheckBox in Hierarchy Mode

2 Answers 31 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Viktor asked on 04 Mar 2014, 04:51 AM
I use manually generating hierarchy mode as it is described in
For bool fields I use GridViewCheckBoxColumn.
When I change bounded bool field in child object, the changes in CheckBoxEditor are not displayed (and vice versa, when I click a CheckBoxEditor, the changes are not reflected in object).
If I press a header for reorder, then the changes are partially displayed, but couple of checkbox are not change.

In debugger I see (rgvMain is RadGridView):


    [Telerik.WinControls.UI.GridViewHierarchyRowInfo]: {Telerik.WinControls.UI.GridViewHierarchyRowInfo}
    AllowedStates: Current | Selected
    AllowResize: true
    Cache: {Telerik.WinControls.UI.GridViewRowInfoCache}
    CanBeCurrent: true
    CanBeExpanded: false
    CanBeSelected: true
    Cells: {Telerik.WinControls.UI.GridViewCellInfoCollection}
    ChildRows: {Telerik.WinControls.UI.GridViewChildRowCollection}
    DataBoundItem: {UsonInfrastructure.Infrastructure.UserData.AccessProjection}
    dataBoundItem: {UsonInfrastructure.Infrastructure.UserData.AccessProjection}
    ErrorText: ""
    Group: null
    HasChildViews: false
    Height: 18
    HierarchyLevel: 1
    Index: 0
    IsAttached: true
    IsCurrent: false
    IsEditable: true
    IsExpanded: false
    IsInitialized: false
    IsModified: false
    IsOdd: false
    IsPinned: false
    IsSelected: false
    IsSystem: false
    IsValid: true
    IsVisible: true
    MaxHeight: -1
    MinHeight: 5
    parent: {Telerik.WinControls.UI.GridViewHierarchyRowInfo}
    Parent: {Telerik.WinControls.UI.GridViewHierarchyRowInfo}
    ParentRow: null
    PinPosition: None
    PropertyChanged: {Method = {Void RowInfo_PropertyChanged(System.Object, System.ComponentModel.PropertyChangedEventArgs)}}
    PropertyChanging: null
    RowElementType: {Name = "GridDataRowElement" FullName = "Telerik.WinControls.UI.GridDataRowElement"}
    rowState: {Telerik.WinControls.UI.GridViewRowInfo.GridViewRowInfoState}
    state: {BitVector32{00000000000000000000000001100001}}
    Tag: null
    Telerik.WinControls.Data.IDataItem.DataBoundItem: {UsonInfrastructure.Infrastructure.UserData.AccessProjection}
    Telerik.WinControls.Data.IDataItem.FieldCount: 3
    ViewInfo: {Telerik.WinControls.UI.GridViewInfo}
    viewInfo: {Telerik.WinControls.UI.GridViewInfo}
    ViewTemplate: {Telerik.WinControls.UI.GridViewTemplate}


    {Reading (GridViewCheckBoxColumn)}
    [Telerik.WinControls.UI.GridViewCheckBoxColumn]: {Reading (GridViewCheckBoxColumn)}
    base {Telerik.WinControls.RadObject}: {Reading (GridViewCheckBoxColumn)}
    Accessor: {Telerik.WinControls.UI.VirtualHierarchyAccessor}
    accessor: {Telerik.WinControls.UI.VirtualHierarchyAccessor}
    AllowGroup: true
    AllowHide: true
    AllowReorder: true
    AllowResize: true
    AllowSort: true
    AutoEllipsis: true
    AutoSizeMode: DisplayedCells
    CanBeCurrent: true
    CanGroup: true
    CanSort: true
    CanStretch: false
    ConditionalFormattingObjectList: Count = 0
    conditionalFormattingObjects: Count = 0
    CustomDataOperation: None
    DisableHTMLRendering: true
    EnableExpressionEditor: false
    EventDispatcher: {Telerik.WinControls.UI.EventDispatcher}
    Expression: ""
    FieldAlias: ""
    FieldName: "ReadAccess"
    HeaderImage: null
    HeaderText: "Reading"
    HeaderTextAlignment: MiddleCenter
    ImageLayout: None
    Index: 1
    IsAutoGenerated: false
    IsCurrent: true
    IsDataBound: false        !!!!! may be this is a cause?
    IsFieldNamePath: false
    isFieldNamePath: false
    IsGrouped: false
    IsPinned: false
    IsSorted: false
    IsVisible: true
    MaxWidth: 60
    MinWidth: 60
    Name: "ReadAccesseffcd8a0-48d6-4e0d-9cda-4ba02cb0b53f"
    ownerTemplate: {Telerik.WinControls.UI.GridViewTemplate}
    OwnerTemplate: {Telerik.WinControls.UI.GridViewTemplate}
    PinPosition: None
    PropertyChanging: null
    ReadOnly: false
    RowSpan: 20
    sortOrder: None
    SortOrder: None
    StretchVertically: true
    Tag: null
    TextAlignment: MiddleLeft
    TextImageRelation: Overlay
    UniqueName: "ReadAccesseffcd8a0-48d6-4e0d-9cda-4ba02cb0b53f"
    VisibleInColumnChooser: true
    Width: 60
    WrapText: false

2 Answers, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 04 Mar 2014, 11:03 AM

It helps:

 foreach (var template in rgvMain.CurrentRow.ViewTemplate.Templates)
                        template.Refresh(); // First time not work
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Mar 2014, 03:12 PM
Hello Viktor,

Thank you for contacting Telerik Support.

When you use RadGridView bound to custom objects, it is necessary to notify the RadGridView for any further changes related to the DataBoundItems. It is necessary to refresh the corresponding template, to which the current row is belonging to, together with refreshing the MasterTemplate:
private void radButton1_Click(object sender, EventArgs e)
  Product  row = this.radGridView1.CurrentRow.DataBoundItem as Product;
  if (row!=null)
      row.Discontinued = !row.Discontinued;

You can refer to our Binding to Hierarchical Data Programmatically help article, where the the changes are automatically refreshed. Our Reflecting Custom Object Changes in RGV help article is quite useful as well about reflecting changes to RadGridView.

I hope this information helps. Should you have further questions, I would be glad to help.


DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question