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

Custom Column, can't insert before size

2 Answers 71 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Matt Dawdy
Top achievements
Rank 1
Matt Dawdy asked on 14 Apr 2010, 03:19 PM
The File Explorer gives you 2 columns out of the box, name and size.  I want to use Name for my databases id field, and add "Display Name" or something to the control, but I want it to appear in front of the "Size" column.  Needless to say I'm providing my own ContentProvider, too.

It works fine if I add the new column to the end of the list, but not if I try to insert it, or to "AddAt".

// Works ok, but not what I need
RadFileExplorer1.Grid.Columns.Add(gridTemplateColumn1);

// Doesn't work like I need.
RadFileExplorer1.Grid.Columns.Insert(1, gridTemplateColumn1);

// Doesn't work like I need.
RadFileExplorer1.Grid.Columns.AddAt(1, gridTemplateColumn1);

Oh --forgot to mention that I'm going to hide the existing Name column after that.
RadFileExplorer1.Grid.Columns[0].Display = false;

Any ideas what I might be doing wrong?

2 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 19 Apr 2010, 04:14 PM
Hi Matt,

I already answered the support ticket on the subject. If you somehow missed my answer I will paste it here as well:

At present, RadFileExplorer does not offer the possibility to re-order the default columns. For the time being, as a workaround I suggest you create and add the required Grid columns(and their order) using the approach provided in this live demo, e.g.:
public override DirectoryItem ResolveDirectory(string path)
 {
     .....
 
     foreach (FileItem fileItem in oldItem.Files)
     {
         .....
         fileItem.Attributes.Add("Size", fInfo.Length.ToString());
         .....
     }
 
     return oldItem;
 }
 

After that hide the default columns using the following code:
protected void Page_Load(object sender, EventArgs e)
{
     RadFileExplorer1.Grid.Columns[0].Display = false;
     RadFileExplorer1.Grid.Columns[1].Display = false;
}

I hope this helps.

All the best,
Dobromir
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Grady Hawley
Top achievements
Rank 1
answered on 19 Apr 2010, 08:36 PM
That worked great!  Thank you very much.
Tags
FileExplorer
Asked by
Matt Dawdy
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Grady Hawley
Top achievements
Rank 1
Share this question
or