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

Hierarchy control does not show up

3 Answers 141 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tony Flaherty
Top achievements
Rank 1
Tony Flaherty asked on 26 Jan 2011, 03:36 PM
I have a hierarchical RadGridView that I am putting a RadPanel with a user control into during cell formatting.  When I expand the row to look at the control all I see is the AddNewRow Pane.  If I set AllowAddNewRow to false the row never expands.  Below is the code I am using to do this. Any help I could get with this would be great.

private void TemplateRelations()
{
    GridViewTemplate template = new GridViewTemplate();
 
    template.Caption = "Tracking Info";
    template.DataSource = trackingInfos;
    gvTrackingInfo.Templates.Add(template);
    template.AllowRowResize = false;
    template.ShowColumnHeaders = false;
    template.ShowRowHeaderColumn = false;
    template.Columns[0].Width = 800;
    template.Rows[0].Height = 500;
    for (int i = 1; i < template.Columns.Count; i++)
    {
        template.Columns[i].IsVisible = false;
    }
 
    GridViewRelation relation = new GridViewRelation(this.gvTrackingInfo.MasterTemplate, template);
    relation.ParentColumnNames.Add("TrackingNumber");
    relation.ChildColumnNames.Add("TrackingNumber");
    this.gvTrackingInfo.Relations.Add(relation);
}
 
 
private void gvTrackingInfo_CellFormatting(object sender, CellFormattingEventArgs e)
{
    TabContainer tabContainer = new TabContainer();
    GridViewDataColumn column = e.CellElement.ColumnInfo as GridViewDataColumn;
    if (column != null && column.OwnerTemplate.Caption == "Tracking Info")
    {
        RadPanel panel = new RadPanel();
        tabContainer.Height = 500;
        tabContainer.Width = 800;
        panel.Controls.Add(tabContainer);
        panel.TextAlignment = ContentAlignment.MiddleCenter;
        e.Row.Height = 500;
        e.Column.Width = 800;
        e.CellElement.Children.Add(new RadHostItem(panel));
    }           
}

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 31 Jan 2011, 10:58 AM
Hi Tony Flaherty,

Similar to WPF our control framework is based on elements. This allows us to apply visual effects not possible when using controls. In addition, elements are lighter in terms of memory and help to achieve better performance. However, this approach brings some issues - like the airspace issue as described in this MSDN article. That is why we do not recommend using controls inside RadGridView. Please look at our demo application, the Grid View - Hierarchy - Tabbed Child Views example describes a bit different approach where we use elements instead of controls. 

Please describe in greater detail what exactly you want to achieve and we will be glad to help further.

I am looking forward to your reply.
 
Regards,
Jack
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
0
Tony Flaherty
Top achievements
Rank 1
answered on 31 Jan 2011, 03:37 PM
Jack,

Here is what I want to achieve.

When the details button is clicked I want the child view to expand showing a tab container.  In the tab container are 4 display forms for showing information about the record they selected and 1 input form for the user to select a resolution about the record.  Once the user selects a resolution and then clicks the Save button we have functionality that will be performed for submitting the resolution to a web service.

Thanks,

Tony
0
Jack
Telerik team
answered on 03 Feb 2011, 11:26 AM
Hi Tony Flaherty,

Thank you for writing me back.

Now I understand your scenario. I think that the Tabbed Child Views example which I mentioned in my previous post will do the job. In the example, RadGridView is bound in hierarchy mode and the child view defines what is visible. Another option is demonstrated in the GridView >> Rows >> Row Details example. Please note that you should hide any control hosted in grid cells when scrolling.

Should you have any further questions, do not hesitate to ask.

Regards,
Jack
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
Tony Flaherty
Top achievements
Rank 1
Answers by
Jack
Telerik team
Tony Flaherty
Top achievements
Rank 1
Share this question
or