Custom Column, can't insert before size

3 posts, 0 answers
  1. Matt Dawdy
    Matt Dawdy avatar
    3 posts
    Member since:
    Apr 2010

    Posted 14 Apr 2010 Link to this post

    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. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 19 Apr 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Grady Hawley
    Grady Hawley avatar
    3 posts
    Member since:
    May 2008

    Posted 19 Apr 2010 Link to this post

    That worked great!  Thank you very much.
Back to Top