This is a migrated thread and some comments may be shown as answers.
Is FileExplorer Size column changeable?
3 Answers 147 Views
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 10 Jul 2009, 03:43 PM
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.

3 Answers, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 14 Jul 2009, 08:37 AM
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.
0
Carsten Molewijk
Top achievements
Rank 1
answered on 03 Feb 2010, 10:48 AM
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.
0
Fiko
Telerik team
answered on 08 Feb 2010, 01:51 PM
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.
Asked by
Tom
Top achievements
Rank 1
Answers by
Lini
Telerik team
Carsten Molewijk
Top achievements
Rank 1
Fiko
Telerik team
Share this question
or