Hierarchy Child Size

20 posts, 0 answers
  1. Susan
    Susan avatar
    6 posts
    Member since:
    Feb 2009

    Posted 19 Feb 2009 Link to this post

    Does anyone know how to get rid of the box around the children in a hierarchy? There seems to be default size that is set regardless of how many children there are. I have autoresize checked to true. It makes the child records take up more room than they should and the box around the children is annoying.

    Susan
  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 20 Feb 2009 Link to this post

    Hello Susan,

    Thank you for this question.

    The border is set through the theme and can be disabled when processing the ViewCellFormatting event. Take a look at this sample code:

    void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) 
        if (e.CellElement is GridDetailViewCellElement) 
        { 
            GridDetailViewCellElement cell = e.CellElement as GridDetailViewCellElement; 
            cell.ChildTableElement.DrawBorder = false
            cell.ChildTableElement.TableBodyElement.DrawBorder = false
        } 

    You can change the child view height when processing the same event. Use this code:

     
    cell.RowInfo.Height = 100; 
     

    Do not hesitate to contact us if you have any other questions.

    Best wishes,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Susan
    Susan avatar
    6 posts
    Member since:
    Feb 2009

    Posted 10 Mar 2009 Link to this post

    That actually didn't work. The border around the children group is still there. The children size is fine. There is just a border around the whole children area that we would like to get rid of.
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 12 Mar 2009 Link to this post

    Hi Susan,

    This code should work. Could you please open a support ticket and send us your application, so we can test it. I will try to find where is the problem.

    I am looking forward to your reply.

    Regards,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Craig Finnigan
    Craig Finnigan avatar
    14 posts
    Member since:
    May 2008

    Posted 09 Apr 2009 Link to this post

    I think that I am trying to do something simular to this.  
        I have my RadGridView setup with a childGridViewTemplate.  I want to remove the blank space between the bottom of the ChildGridView and the top of the next parent row.

    When i enter the line 

     

    If e.CellElement Is GridDetailViewCellElement Then

     

     

    End If

    I get the error GridDetailViewCellElement  is a type and connot be used as an expression.

    Is there something else that I should be doing here in my ViewCellFormatting event?

     

  7. gerbrand
    gerbrand avatar
    78 posts
    Member since:
    Mar 2009

    Posted 10 Apr 2009 Link to this post

    Hi Susan,

    What I think you have to do:

    1 private void rgvAdserver_ViewCellFormatting(object sender, CellFormattingEventArgs e) 
    2         { 
    3             if (!(e.CellElement is GridDetailViewCellElement)) return
    4             var cell = e.CellElement as GridDetailViewCellElement; 
    5             if (cell == nullreturn
    6             cell.ChildTableElement.DrawBorder = false
    7             cell.ChildTableElement.TableBodyElement.DrawBorder = false
    8             cell.ChildTableElement.Padding.All = 0; //removes the box around the childs 
    9         } 

    But I'm getting an error on line 8. Saying :
    "Cannot modify the return value of 'Telerik.WinControls.RadElement.Padding' because it is not a variable"

    But it is a getter, setter. So I'm not sure why I get this error.



  8. gerbrand
    gerbrand avatar
    78 posts
    Member since:
    Mar 2009

    Posted 10 Apr 2009 Link to this post

    Okay found a work around for the padding box around the children.

    When you make a new theme with the theme builder. You can remove those padding borders easily here.

    Once you've saved your theme (.xml), you add a radThemeManager to you form. In this manager you get your just created theme.

    Now you need to apply it to your grid. just select the little arrow at the topborder of the gridview. There you can select at "theme name" your created theme.


  9. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 10 Apr 2009 Link to this post

    Hi gerbrand,

    Thank you for sharing your solution. Yes, you can use the Visual Style Builder to change easily the visual appearance of our controls.

    Regarding the Padding property: It is a value type and you can't change its properties this way. You should create a new Padding, set its properties and then assign the new Padding object. Here is a sample:

    cell.ChildTableElement.Padding.All = new Padding(0); 
     

    Craig, use the code below to remove the spacing programmatically:

    Private Sub radGridView1_ViewCellFormatting(ByVal sender As ObjectByVal e As CellFormattingEventArgs) 
        Dim cell As GridDetailViewCellElement = TryCast(e.CellElement, GridDetailViewCellElement) 
        If cell IsNot Nothing Then 
            e.CellElement.Padding = New Padding(0) 
        End If 
    End Sub 
     
     

    Should you have further questions, feel free to write us.

    Kind regards,
    Jack
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  10. Craig Finnigan
    Craig Finnigan avatar
    14 posts
    Member since:
    May 2008

    Posted 14 Apr 2009 Link to this post

    Dear Jack "in the box", 
        This code did not work... I put this code in and i still see the space between the bottom of the ChildGridView and the next row of the parent grid view.
    Any other suggestions?
  11. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 17 Apr 2009 Link to this post

    Hello Craig Finnigan,

    You can also reset the BorderWidth of the DetailViewCellElement:

    Private Sub HierarchyForm_Load(ByVal sender As ObjectByVal e As EventArgs) 
        ' TODO: This line of code loads data into the 'northwindDataSet.Orders' table. You can move, or remove it, as needed. 
        Me.ordersTableAdapter.Fill(Me.northwindDataSet.Orders) 
        ' TODO: This line of code loads data into the 'northwindDataSet.Customers' table. You can move, or remove it, as needed. 
        Me.customersTableAdapter.Fill(Me.northwindDataSet.Customers) 
         
        AddHandler Me.radGridView1.ViewCellFormatting, AddressOf radGridView1_ViewCellFormatting 
    End Sub 
     
    Private Sub radGridView1_ViewCellFormatting(ByVal sender As ObjectByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) 
        Dim cell As GridDetailViewCellElement = TryCast(e.CellElement, GridDetailViewCellElement) 
        If cell IsNot Nothing Then 
            e.CellElement.Padding = New Padding(0) 
            e.CellElement.BorderWidth = 0 
        End If 
    End Sub 

    Do not hesitate to write me back if you have further questions.

    Sincerely yours,
    Julian Benkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  12. Jeremy Murtishaw
    Jeremy Murtishaw avatar
    86 posts
    Member since:
    Apr 2009

    Posted 16 May 2009 Link to this post

    Hello,

    I'm actually still having trouble with this, despite the info on this thread and my research around the site. I would like to programmatically get rid of the padding and border around the embedded hierarchical child grids. I've tried all of the code listed in this section and none of it is working for me.

    Also, a related issue I'm having is with the Plus signs for expanding rows. I've seen many ASP.NET postings where its explained how to get rid of this image if there are no children for a particular row, but I haven't seen the equivalent for C#. Can anyone help me here?

    Thanks!
    Jeremy
  13. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 20 May 2009 Link to this post

    Hi Jeremy Murtishaw,

    I would like to receive more information about the issues that you have with the Padding of the child views. The code that my colleague Julian suggested removes the padding, so I cannot understand what is the exact look that you want to achieve. Please open a new support ticket and send me screenshots with the problem areas highlighted and details about the desired look.

    As to your second question, I suppose the you mean WinForms technology with a code snippet in C#. If so, please refer to the following Knowledge Base article: Hide expand/collapse image in hierarchical RadGridView.

    If you have additional questions, feel free to contact me.

    All the best,
    Nikolay
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  14. olivier pareige
    olivier pareige avatar
    6 posts
    Member since:
    Aug 2012

    Posted 18 May 2010 Link to this post

    Hello,

    This is the same for me : I would like to programmatically get rid of the padding and border around the embedded hierarchical child grids. I've tried all the solutions proposed in this thread, I've tried a lot of other things, but I Didn't manage to do that.

    Is there news about this issue ?

    Thanks in advance !
  15. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 20 May 2010 Link to this post

    Hi olivier,

    The solution provided in this forum should do the job. Basically you should set the Padding to 0 and disable the border by setting DrawBorder property to false

    If the issue continues to appear, please specify which is your version of RadControls for WinForms and send us your application in a support ticket and we will try to locate the issue.

    Regards,

    Jack
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  16. olivier pareige
    olivier pareige avatar
    6 posts
    Member since:
    Aug 2012

    Posted 25 May 2010 Link to this post

    Hello,

    Thanks for your response. For me it does'nt work. Perhaps am i doing something wrong. I've done a little solution as example. I'll open a support ticket and send you the solution.

    Thanks.


  17. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 27 May 2010 Link to this post

    Hi olivier pareige,

    Thank you for getting back to us. We are looking forward to receiving your project.

    All the best,
    Jack
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  18. David
    David avatar
    9 posts
    Member since:
    Sep 2010

    Posted 27 Sep 2010 Link to this post

    I too would like to know how this was resolved.  It looks to me that the responses from Telerik were trying to show how to set the border style and width for a cell within the child grid, but the question was specifically regarding the border around the entire child grid itself.  

    I'm spending an inordinate amount of time trying to get this simple styling issue to work, but I'd love to see some working code for the last issue. 
  19. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 29 Sep 2010 Link to this post

    Hi David,

    In order to hide the border of RadGridView, please refer to the code snippet below:
    this.radGridView1.GridViewElement.BorderWidth = 0;
    this.radGridView1.Padding = new Padding(0);

    I hope this helps.

    Sincerely yours,
    Nikolay
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  20. Aarvey
    Aarvey avatar
    4 posts
    Member since:
    Oct 2012

    Posted 25 Mar 2013 Link to this post

    I have the same problem in WPF RadGridView. How can i solve the padding issue with the hierarchical child.
  21. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 26 Mar 2013 Link to this post

    Hello Aarvey,

    This forum concerns RadControls for WinForms, while your question is related to RadControls for WPF. Please address your question in the appropriate forums, so you can get adequate assistance: http://www.telerik.com/community/forums/wpf/gridview.aspx.
     
    All the best,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top
UI for WinForms is Visual Studio 2017 Ready