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

Refresh RadFilter Issue

1 Answer 125 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Vinod
Top achievements
Rank 1
Vinod asked on 26 Feb 2012, 07:27 PM
Hi,

I am new to telerik, please help me.

I want to reset my radfilter using following script

rfGridFilter.RootGroup.Expressions.Clear();
rfGridFilter.RecreateControl();

Above code runs well in other place in my page instead of page_load.
actually I got new requirement for my project that user can change the profile by selecting new profile in rad combo box profile list.
To accomplice this I am creating radgrid dynamically on page_init and doing datasetup() method on page_load for grid binding when page first time load or when user change profile.

My problem is that when user change profile I want to reset(clear radfilter) filter and after that I am calling datasetup method.
But my radgrid is still using previous filter expression while I am clearing my radfilter using above code.
I don't know where I am doing wrong. While above code runs well in other place This is creating problem when I am calling this before datasetup.
Please help me. Thanx in advance!!!
I am listing other code that I am using.

On page_init

//grid creation dynamic code

            // Main Grid Config & Code
            rgModuleGrid = new RadGrid();
            rgModuleGrid.ID = "rgModuleGrid";

            rgModuleGrid.ItemCreated += rgModuleGrid_ItemCreated;
            rgModuleGrid.ItemCommand += rgModuleGrid_ItemCommand;
            rgModuleGrid.PreRender += rgModuleGrid_PreRender;
            
            rgModuleGridSetup(profileId);//set all the grid properties and configuraion for mastertable view and clientsettings
            GridPlaceHolder.Controls.Add(rgModuleGrid);

On Page_load
////for clear radfilter when profile changes
if (Convert.ToInt32(ViewState["profileId"]) != profileId && IsPostBack)
                {                                        
                    rfGridFilter.RootGroup.Expressions.Clear();
                    rfGridFilter.RecreateControl();

                    DataSetup();
                }
                else
                {
                    DataSetup();                   
                }

My Datasetup method is:

protected void DataSetup()
{
////Here oadsMain is a open access data source controls and EmpByAVF, EmpByAVR and EmpByAVY is the ORM view that work just like table.
 oadsMain.ObjectContextProvider = "iTracker.Data.Orm.iProjectModel, iTracker.Data.Orm";
                if(profileId == 36)
                    oadsMain.TypeName = "iTracker.Data.Orm.EmpByAVF";
                else if(profileId == 37)
                    oadsMain.TypeName = "iTracker.Data.Orm.EmpByAVR";
                else if (profileId == 38)
                    oadsMain.TypeName = "iTracker.Data.Orm.EmpByAVY";

                oadsMain.EnableDelete = false;
                oadsMain.EnableUpdate = false;
                oadsMain.EnableInsert = false;
             
                oadsMain.StoreOriginalValuesInViewState = false;
                rgModuleGrid.DataSourceID = "oadsMain";               
 }             



 

1 Answer, 1 is accepted

Sort by
0
Vinod
Top achievements
Rank 1
answered on 27 Feb 2012, 06:43 PM
Hi,

I resolved this issue by setting the

rgModuleGrid.AllowFilteringByColumn = false;

before calling datasetup() method.

Now my application is working fine.

 

 

Tags
Filter
Asked by
Vinod
Top achievements
Rank 1
Answers by
Vinod
Top achievements
Rank 1
Share this question
or