Removing a Column from Telerik RadGrid at Runtime

by Tom Hundley 11. June 2010 07:13

If you need to remove a column from a Telerik RadGrid at runtime, subscribe to the grid's DataBound event, find the column by its unique name, and set its display property to false.  This is the correct way to do this without breaking the filter functionality.  For a long time I was subscribing to the grid's ItemDataBound event and hiding each dataitem for the column- only now did I realize that the filter was broken by doing it that way.

 

Example:

protected void rgPartDispositionHistory_DataBound(object sender, EventArgs e)
    {
        rgPartDispositionHistory.MasterTableView.Columns
.FindByUniqueName("PeopleSoftId").Display = isTwtc; }
 

Tom Hundley
Elegant Software Solutions, LLC

Tags: , ,

ASP.Net | Telerik

Add comment

biuquote
  • Comment
  • Preview
Loading