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

TableBodyElement

6 Answers 109 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Svein Thomas
Top achievements
Rank 1
Svein Thomas asked on 17 Nov 2010, 03:18 PM
Hi,

I have a master/child table were i like to remove the border around the child table or just resize the child.
I found a thread that had some of the same elements that i was looking for, but the solution did not work.

One of the part that did not work was this:

if (e.CellElement is GridDetailViewCellElement)
            {
                GridDetailViewCellElement cell = e.CellElement as GridDetailViewCellElement;
                cell.ChildTableElement.DrawBorder = false;
                cell.ChildTableElement.TableBodyElement.DrawBorder = false;
            }
The TableBodyElement is not in the property list of ChildTableElement. 
Is there another way to remove the border around the child.
And is there a way to resize the child grid?

Regards
Svein Thomas

6 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 17 Nov 2010, 05:36 PM
Hello,

you can resize the inner section by subscribing to the ViewCellFormatting event and setting the MaxSize property on the child table element.
Private Sub GridView_ViewCellFormatting(ByVal sender As Object, _
    ByVal e As CellFormattingEventArgs) Handles RadGridView1.ViewCellFormatting
    If TypeOf e.CellElement Is GridDetailViewCellElement Then
        DirectCast(e.CellElement, GridDetailViewCellElement).ChildTableElement.MaxSize = New Size(200, DirectCast(e.CellElement, GridDetailViewCellElement).ChildTableElement.Size.Height)
    End If
End Sub

Also see screenshot.
Hope this helps
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 17 Nov 2010, 05:40 PM

Hello again,

A further way would be to replace the above MaxSize with the StretchHorizontally property.

DirectCast(e.CellElement, GridDetailViewCellElement).ChildTableElement.StretchHorizontally = False

Best regards,
Richard
0
Bernd Mueller
Top achievements
Rank 1
answered on 29 Nov 2010, 06:14 PM
Hello everyone,

this is very interesting. It works to reduce the size of the child table by limitting the maxsize, but when trying to increase the size (setting minsize) you get drawing errors. The child table is then partially hidden by other rows.

Is there a way to increase child table size to display all rows?

Thank you and best regards,

Bernd
0
Accepted
Svett
Telerik team
answered on 02 Dec 2010, 03:29 PM
Hi Bernd,

By default, RadGridView determines the size of the child table elements hierarchy based on their content. If the RadGridView control dimensions are less that the size required by the child table element, horizontal or vertical scroll bar appears.

Greetings,
Svett
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
0
Bernd Mueller
Top achievements
Rank 1
answered on 02 Dec 2010, 10:40 PM

Hello Svett,

the scrollbars are working, but i would like to extend the size of the child table to display all (or much more than the current 10) rows. As i already wrote, stting the min size of the childtableelement in the ViewCellFormatting-Event was not working properly. Maybe there is another way to do this?

Best regards

Bernd

0
Accepted
Bernd Mueller
Top achievements
Rank 1
answered on 03 Dec 2010, 01:12 PM
Sorry for the trouble.
I made the error and used
    UseScrollbarsInHierarchy = True

To display all items in the child table withing scrolling you have to set UseScrollbarsInHierarchy to false of course.
Tags
GridView
Asked by
Svein Thomas
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Bernd Mueller
Top achievements
Rank 1
Svett
Telerik team
Share this question
or