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

Changing the Grid Structure Dynamically on Postback and filtering

1 Answer 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alfonso
Top achievements
Rank 1
Alfonso asked on 05 Nov 2014, 10:41 AM
Hi,

I am creating a RadGrid programmatically following the instructions in http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html#Section22 (section Creating the grid entirely in the code-behind -- Creating a RadGrid on Page Init).

I want to change structure dinamically because I have a panel with checkboxes where user can select which columns will be shown and when a button is pressed grid is created with those columns. I am following instructions in http://www.telerik.com/help/aspnet-ajax/grid-changing-structure-dynamically.html, so I am setting EnableColumnViewState = false.

The problem is that when I filter grid with multiple columns, only last filter is applied. For example, if I apply filter to Column1 and then apply filter to Column2, only Column2 is showing filter and Column1 filter cell is cleared. How can I avoid this behaviour?

Best regards,

Alfonso

1 Answer, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 10 Nov 2014, 07:37 AM
Hello Alfonso,

The behavior that you are observing is due to the fact that you are disabling the ViewState of the columns. When the EnableColumnsViewState is set to false, you will not be able to preserve the filter state of the columns and you will end up with only one filter applied. This should be considered as a limitation with such dynamically changed grid structure.

What I could suggest for your requirement is to keep the EnableColumnsViewState property to true and include all the columns in your RadGrid, but depending on the checked check boxes that you have, change the Display/Visible property of the columns. With such approach you will be able to filter on multiple columns and still display only the necessary columns.

Hope this helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Alfonso
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or