How to Manage RadGridView width to Auto once I remove dynamically added columns and column groups

7 posts, 0 answers
  1. Laxman
    Laxman avatar
    24 posts
    Member since:
    Aug 2012

    Posted 24 Sep 2012 Link to this post

    Hi Telerik Support Team,

    I am facing trouble in RadGridView's width which gets increased when I add dynamic columns and their column group headers as per business requirement and at run time only I am removing dynamically added columns and column group headers but the width of the RadGridView never decreased and it does not look good of having grid without any columns on right hand side with horizantol scroll bar.

    I hope someone will support me on this trouble.

    Thanks
    Laxman

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 24 Sep 2012 Link to this post

    Hello,

    I have tested controlling the visibility of the columns using the IsVisible property for the column and the width for the GridView was recalculated fine. Do you add/remove the columns or do you just show/hide them in the GridView? Have you tested this with the latest version?

    Greetings,
    Didie
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  3. Laxman
    Laxman avatar
    24 posts
    Member since:
    Aug 2012

    Posted 24 Sep 2012 Link to this post

    Hi Didie,

    I am adding columns and Column Groups dynamically (at run time) and removing dynamic Columns and column groups at run time as well. So once I remove dynamic columns and column groups it does not decrease RadGridView width accordingly which I set Auto in .xaml file and Grid column which is parent contaier for Rad grid view also has width="Auto".

    Please help me to solve this issue.

    Thanks

    Laxman.

  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 25 Sep 2012 Link to this post

    Hi Laxman,

     I was not able to reproduce the issue. Please find attached my test project for a reference. May I ask you to change it to show your case?

    All the best,
    Didie
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  5. Laxman
    Laxman avatar
    24 posts
    Member since:
    Aug 2012

    Posted 26 Sep 2012 Link to this post

    Hi Support Team,

    I am not  only adding dynamic columms but Column Groups as well and removing dynamic columns and columns group as run time as per business requirement.  After my R & D I found that once I removed dynamic columns and column groups I must use call UpdateLayout() method of the grid. like following.

    this.rgvGrid.ColumnGroups.RemoveAt(count);

     

    this.rgvGrid.Columns.RemoveAt(count);
    this.rgvGrid.UpdateLayout();

     

    the last line solves the issue.

    thanks
    Laxman

     

     

     

     

     

     

     

     

     

     

     

     





  6. Ahmad
    Ahmad avatar
    2 posts
    Member since:
    May 2020

    Posted 20 May in reply to Laxman Link to this post

    I'm Creating ColumnGroup and Bind the details firsttime.after that the button click cause invalid column name. Anyone can help me?

    (Column Group Created in Page_Init)

  7. Dinko
    Admin
    Dinko avatar
    1144 posts

    Posted 25 May Link to this post

    Hi Ahmed,

    I have checked the provided stack trace, and it seems that you are using a web component. This forum is related to UI for WPF. May I ask you to share which Grid component are you using so that I can transfer your question to the correct team.

    Regards,
    Dinko
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
Back to Top