TableBodyElement

7 posts, 3 answers
  1. Svein Thomas
    Svein Thomas avatar
    47 posts
    Member since:
    Nov 2010

    Posted 17 Nov 2010 Link to this post

    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
  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 17 Nov 2010 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 17 Nov 2010 Link to this post

    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
  5. Bernd Mueller
    Bernd Mueller avatar
    38 posts
    Member since:
    May 2010

    Posted 29 Nov 2010 Link to this post

    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
  6. Answer
    Svett
    Admin
    Svett avatar
    728 posts

    Posted 02 Dec 2010 Link to this post

    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.
  7. Bernd Mueller
    Bernd Mueller avatar
    38 posts
    Member since:
    May 2010

    Posted 02 Dec 2010 Link to this post

    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

  8. Answer
    Bernd Mueller
    Bernd Mueller avatar
    38 posts
    Member since:
    May 2010

    Posted 03 Dec 2010 Link to this post

    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready