Is FileExplorer Size column changeable?

4 posts, 0 answers
  1. Tom
    Tom avatar
    13 posts
    Member since:
    Jul 2012

    Posted 10 Jul 2009 Link to this post

    I tried to change the format of Size column in the FileExplorer Grid control. e.g., 1,234 KB, etc. with DataFormatString if possible, such as

    GridBoundColumn

    sc = (GridBoundColumn)e.Column;

    sc.DataFormatString = "{0:###,### KB}";


    However, I couldn't find a way to modifiy it. Even, I tried to make it invisible using

    RadFileExplorer1.Grid.Columns.RemoveAt(1);
    It makes header part disappeared, but it still shows the size value in the data grid.

    I also tried to use Grid ItemDataBound as follows, it doesn't work. I found after fired RadFileExplorer1_Grid_ItemDataBound, the RadFileExplorer1 refreshes whole grid again and make it as it was, i.e., before my rendering is applied.

     

    protected

    void RadFileExplorer1_Grid_ItemDataBound(object sender, GridItemEventArgs e)

    {

    if (e.Item is GridDataItem)

    {

    GridDataItem item = (GridDataItem)e.Item;

    item["Size"].Text = string.Format("{0:###,### KB}", item["Size"].Text);

    }

    }

    As far as what i've successed in the format change is just an alignment as like:

     

    protected

    void RadFileExplorer1_Grid_ColumnCreated(object sender, GridColumnCreatedEventArgs e)

    {

    RadFileExplorer1.Grid.Columns[1].ItemStyle.HorizontalAlign = HorizontalAlign.Right;

    RadFileExplorer1.Grid.Columns[1].ItemStyle.Width = 30;

    RadFileExplorer1.Grid.Columns[1].HeaderStyle.HorizontalAlign = HorizontalAlign.Center;

    RadFileExplorer1.Grid.Columns[1].HeaderStyle.Width = 30;

    }

    Thanks.

  2. Lini
    Admin
    Lini avatar
    2144 posts

    Posted 14 Jul 2009 Link to this post

    Hi Tom,

    The file explorer's Grid is using client databinding. This means that none of the server-side databinding events will have any effect on the control. The grid is bound in the browser each time you change the file explorer's current folder. At the moment it is not possible to modify the default grid columns (name and size) on the server.

    However, you can create a custom grid column and display the file size there. We have a similar example in our online demos - http://demos.telerik.com/aspnet-ajax/fileexplorer/examples/customgridcolumns/defaultcs.aspx. As I said it is not possible to hide the size column, but you can resize it to 1 px, which will make it practically invisible and leave only your custom size column:

    GridColumn SizeColumn = RadFileExplorer1.Grid.Columns.FindByUniqueNameSafe("Size"); 
    SizeColumn.ItemStyle.Width = Unit.Pixel(1); 
    SizeColumn.HeaderStyle.Width = Unit.Pixel(1); 

    Regards,
    Lini
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Carsten Molewijk
    Carsten Molewijk avatar
    5 posts
    Member since:
    Feb 2010

    Posted 03 Feb 2010 Link to this post

    Is there allready a solution for this issue? Becaues i think it is not a neat solution to resize the column and add a custom grid column.
  4. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 08 Feb 2010 Link to this post

    Hi Carsten,

    I believe that this Code library will be of help.

    Kind regards,
    Fiko
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Back to Top