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

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

6 Answers 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Laxman
Top achievements
Rank 1
Laxman asked on 24 Sep 2012, 08:52 AM
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

6 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 24 Sep 2012, 10:21 AM
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.

0
Laxman
Top achievements
Rank 1
answered on 24 Sep 2012, 12:58 PM
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.

0
Dimitrina
Telerik team
answered on 25 Sep 2012, 08:57 AM
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.

0
Laxman
Top achievements
Rank 1
answered on 26 Sep 2012, 12:40 PM
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

 

 

 

 

 

 

 

 

 

 

 

 





0
Ahmad
Top achievements
Rank 1
answered on 20 May 2020, 01:31 PM

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)

0
Dinko | Tech Support Engineer
Telerik team
answered on 25 May 2020, 11:03 AM

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.
Tags
General Discussions
Asked by
Laxman
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Laxman
Top achievements
Rank 1
Ahmad
Top achievements
Rank 1
Dinko | Tech Support Engineer
Telerik team
Share this question
or