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

Grid is not refreshing in prerender event

3 Answers 187 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Yasar
Top achievements
Rank 1
Yasar asked on 10 Feb 2012, 01:12 PM
Hi,

I'm hiding some of the column of detail table view in prerender event but the grid is not refreshing .

once I expand and collapse the grid it's refreshing.

 
var hideColumn = DBContext.TankMeasurementTypes.Where(p => p.TankMeasurementType_id == strpID);
 
            foreach (var x in hideColumn)
            {
                if (x.FK_MeasurementId == 2)
                {
                    grdTakStrap.MasterTableView.DetailTables[0].GetColumn("Tot_Volumne").Visible = false;
                    grdTakStrap.MasterTableView.DetailTables[0].GetColumn("Est").Visible = true;
                    grdTakStrap.MasterTableView.DetailTables[0].GetColumn("Feetperinch").Visible = true;
                    grdTakStrap.MasterTableView.DetailTables[0].GetColumn("Increment_Start").Visible = true;
                    grdTakStrap.MasterTableView.DetailTables[0].GetColumn("Increment_End").Visible = true;
                    grdTakStrap.MasterTableView.DetailTables[0].GetColumn("StrapLength").Visible = true;
                    grdTakStrap.MasterTableView.DetailTables[0].CommandItemSettings.AddNewRecordText = "Add Strap";
 
                }
                else
                {
                    grdTakStrap.MasterTableView.DetailTables[0].GetColumn("Tot_Volumne").Visible = true;
                    grdTakStrap.MasterTableView.DetailTables[0].GetColumn("Est").Visible = false;
                    grdTakStrap.MasterTableView.DetailTables[0].GetColumn("Feetperinch").Visible = false;
                    grdTakStrap.MasterTableView.DetailTables[0].GetColumn("Increment_Start").Visible = false;
                    grdTakStrap.MasterTableView.DetailTables[0].GetColumn("Increment_End").Visible = false;
                    grdTakStrap.MasterTableView.DetailTables[0].GetColumn("StrapLength").Visible = false;
                    grdTakStrap.MasterTableView.DetailTables[0].CommandItemSettings.AddNewRecordText = "Add BBL/Inch";
                }


please help me for this issue

Regards,
Yasar

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Feb 2012, 08:01 AM
Hello Yasar,

Try calling Rebind() method after hiding the columns.
C#:
grdTakStrap.MasterTableView.Rebind();

-Shinu.
0
Yasar
Top achievements
Rank 1
answered on 14 Feb 2012, 09:09 AM
Hello Shinu,

I used your code grdTakStrap.MasterTableView.Rebind(); but expand and collapse is not working.

Regards,
Yasar
0
Tsvetina
Telerik team
answered on 14 Feb 2012, 03:24 PM
Hello Yasar,

Can you confirm whether you have AJAX in the scenario and in such case, does the grid refresh correctly when you temporarily disable it? If so, review your AJAX settings, there may be something missing.

Other than this, you can try looping through the hierarchy as advised in the following help article and hiding the columns in this loop:
http://www.telerik.com/help/aspnet-ajax/grid-traversing-detail-tables-items-in-grid.html (section Looping through all detail tables/items in Telerik RadGrid)

Greetings,
Tsvetina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
General Discussions
Asked by
Yasar
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Yasar
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or