I'm attempting to adjust the column width programatically and from other forum posts I've read that there is allot involved.
I can Hide Column content on ItemDataBound, but I cannot collapse the width.
Using JustCompile and the debugger I believe I'm setting all the proper widths, but I cannot get it to collapse.
below is my code.
Can you provide any insight on the events between ItemDataBound and rendering and if there is an event between where I can adjust these values.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Thanks
Steve
                                I can Hide Column content on ItemDataBound, but I cannot collapse the width.
Using JustCompile and the debugger I believe I'm setting all the proper widths, but I cannot get it to collapse.
below is my code.
Can you provide any insight on the events between ItemDataBound and rendering and if there is an event between where I can adjust these values.
public static void RemoveColumns(this Telerik.Reporting.Table tableDef, params int[] columns){    /*    var colGroups = Flatten(tableDef.ColumnGroups).ToList();    foreach (int column in columns)    {        // colGroups[column].Visible = false; // Object not found Error in binding        colGroups[column].Filters.Clear();        colGroups[column].Filters.Add(new Telerik.Reporting.Filter("=1", Telerik.Reporting.FilterOperator.Equal, "=0")); // Object not found Error in binding    }    return;    */    var tableBody = tableDef.Body;    var tableCells = tableBody.Where(x => x.ReportItem != null).ToList();    var zero = Telerik.Reporting.Drawing.Unit.Inch(0);    foreach (int colIndex in columns.OrderByDescending(x => x))    {        tableBody.Columns[colIndex].Width = zero;        // shrink all cell.reportItem(s)        foreach (var cell in tableCells.Where(x => x.ColumnIndex == colIndex))        {            // cell.ReportItem.Visible = false; throws error during Binding            cell.ReportItem.Width = zero;                                 if (cell.ReportItem is Telerik.Reporting.TextItemBase)                ((Telerik.Reporting.TextItemBase)cell.ReportItem).CanGrow = false;        }    }}         /// <summary>/// ItemDataBound, Remove columns by settings its content Visibility/// </summary>/// <param name="table"></param>/// <param name="columns"></param>public static void RemoveColumns(this Telerik.Reporting.Processing.Table table, params int[] columns){    RemoveColumns((Telerik.Reporting.Table)table.ItemDefinition, columns);    var zero = Telerik.Reporting.Drawing.Unit.Inch(0);                 foreach (var textbox in table.TableCells(x => columns.Contains(x.ColumnIndex)).OfType<Telerik.Reporting.Processing.TextBox>())    {        // textbox.Visible = false; // Doesn't collapse column        textbox.Width = zero;        textbox.Value = string.Empty;        TextboxCanGrowProperty.SetValue(textbox, false, null);    }    foreach (var column in table.Columns.Where(x => columns.Contains(x.Index)))    {        TableColumnWidthProperty.SetValue(column, 0D, null);    }}private static IEnumerable<Telerik.Reporting.Processing.ITableCell> TableCells(this Telerik.Reporting.Processing.Table table, Func<Telerik.Reporting.Processing.ITableCell, bool> predicate = null){    Telerik.Reporting.Processing.ITableCell cell;    int colCount = table.Columns.Count;    int rowCount = table.Rows.Count;    for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)    {        for (int colIndex = 0; colIndex < colCount; colIndex = colIndex + cell.ColumnSpan)        {            cell = table.GetCell(rowIndex, colIndex);            if (predicate == null || predicate(cell))                yield return cell;        }    }}public static IEnumerable<Telerik.Reporting.TableGroup> Flatten(this IEnumerable<Telerik.Reporting.TableGroup> collection){    foreach (var group in collection)    {        yield return group;        foreach (var subGroup in Flatten(group.ChildGroups))            yield return subGroup;    }}private static PropertyInfo _tablecolumnWidthProperty = null;public static PropertyInfo TableColumnWidthProperty{    get    {        if (_tablecolumnWidthProperty == null)            _tablecolumnWidthProperty = typeof(Telerik.Reporting.Processing.TableColumn).GetProperty("Width", BindingFlags.Instance | BindingFlags.NonPublic);        return _tablecolumnWidthProperty;    }}private static PropertyInfo _textboxCanGrowProperty = null;public static PropertyInfo TextboxCanGrowProperty{    get    {        if (_textboxCanGrowProperty == null)            _textboxCanGrowProperty = typeof(Telerik.Reporting.Processing.TextItemBase).GetProperty("CanGrow", BindingFlags.Instance | BindingFlags.NonPublic);        return _textboxCanGrowProperty;    }}Thanks
Steve
