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

Dynamic Column-Hide Issue

6 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chandran Chandran
Top achievements
Rank 1
Chandran Chandran asked on 30 Apr 2010, 11:18 AM
Dear Telerik,

                 I am having an issue in hiding and showing columns dynamically in grid. To tell about my scenario, my grid has to be loaded with only fewer number of columns, the rest of the columns i set the visibility to false in the Page_Load event.

The grids look and feel is fine before the operations like grouping is done, once after I grouped any of the column then the column width collapsed. I am assuming that the grid assigns the width of hidden columns to the any one of available or remain columns in the grid. After I checked on the hided columns through header context menu. Then the gris is looking fine.

So please let me know what are the possibilities to adjust the width of the columns with the available columns during the grouping, etc.

Regrds,
Chandran
                     

6 Answers, 1 is accepted

Sort by
0
Chandran Chandran
Top achievements
Rank 1
answered on 03 May 2010, 03:53 PM

Dear Telerik,
                    I missed to give some coding information about the scenario. My grid has the width of 100% and my columns width measured also in percentage.In aspx page i added following property.

 <ClientSettings AllowDragToGroup="true" AllowColumnHide="true"

My cs code is;

protected void Page_Load(object sender, EventArgs e)  
    {  
        RadGrid1.MasterTableView.GetColumn("EmpName").Display = false;  
        RadGrid1.MasterTableView.GetColumn("EmpState").Display = false;          
    } 

I hope the above information also helps to reach out the solution;

Regards,
Chandran

0
Tsvetoslav
Telerik team
answered on 05 May 2010, 01:19 PM
Hello Chandran,

This behavior is only natural since when grouping the grid adds additional Expand/Collapse columns to the table view leaving less space for the remaining columns. You need to set fixed with for the columns that you need to stay unchanged in terms of space taken.

Hope it helps.

Regards,
Tsvetoslav
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.
0
Chandran Chandran
Top achievements
Rank 1
answered on 05 May 2010, 02:48 PM
HI Tsvetoslav,
                    Thanks for your reply. I am having almost 14 columns in my grid. In order to get a better view i set the width of the columns in percentage based on its content length of each column, so that only my grid is ccupied with all of those columns, As you suggested to apply Fixed Width in Mastertableview. Is this applicable with my scenario or with my percentage width columns.

Regards,
Chandran
0
Tsvetoslav
Telerik team
answered on 10 May 2010, 04:29 PM
Hello Chandran,

You should set the HeaderStyle.Width property of each column in pixels - and in this sense I meant having fixed width for the columns. I am afraid setting percentage widths for the columns is not a viable solution to the issue you have encountered.

All the best,
Tsvetoslav
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.
0
Chandran Chandran
Top achievements
Rank 1
answered on 11 May 2010, 02:07 PM
Hi Tsvetoslav,
                        I did as you instructed but no use, the issue still presisits. Is there any other way to overcome the same?

-Chandran
        
0
Tsvetoslav
Telerik team
answered on 12 May 2010, 03:38 PM
Hi Chandran,

Could you paste your complete aspx mark-up and code-behind.

Thanks in advance.

Regards,
Tsvetoslav
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.
Tags
Grid
Asked by
Chandran Chandran
Top achievements
Rank 1
Answers by
Chandran Chandran
Top achievements
Rank 1
Tsvetoslav
Telerik team
Share this question
or