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

how to add a time column to DialogOpener window?

1 Answer 68 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Roger Chen
Top achievements
Rank 1
Roger Chen asked on 17 Mar 2010, 07:04 AM
I want to add a time column in DialogOpener window, how can i do? current column only contain name column and size column. But it does't enough in some scene.

Best Regards

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 17 Mar 2010, 01:56 PM
Hi Roger,

By design the File Browser dialogs of RadEditor do not offer an Uploaded Date column. You can add such a column by implementing a FileSystemContentProvider. The following live demo for RadFileExplorer demonstrates how to do this: Add custom columns.  You should add one additional else check in this function and sort the items in the custom date column:

  protected void RadFileExplorer1_ExplorerPopulated(object sender, RadFileExplorerPopulatedEventArgs e)
        {
            //implement sorting for the custom Date column
            string sortingColumn = e.SortColumnName;
            if (sortingColumn == "Date")
            {
                DateComparer dc = new DateComparer();
                e.List.Sort(dc);
                if (e.SortDirection.IndexOf("DESC") != -1)
                {
                    //reverse order
                    e.List.Reverse();
                }
            }
            else
            {
              /* add here your code for sorting */
            }
        }


Here is addition information:

A RadFileExplorer is used in the RadEditor's dialogs and you need to apply the above approach to the RadFilExplorer located in the FileBrowser.ascx file. This article describes in details how to get reference to the RadFileExplorer control and apply its properties. For your convenience, however, I have attached a fully working demo project here (you need to add a BIN folder with Telerik.Web.UI.dll file inside). In the project, a new Date attribute is added to the FileBrowserItem and then it is used in the ExplorerPopulated event of the RadFileExplorer control in order to sort the items.
As you see the current implementation does not show the newly added Date attribute in the grid (but the items are sorted), but you can uncomment  the code bellow in the customControl_VB.ascx file and a new Date column will be added to the Grid:
Copy Code
' Uncomment this code if you need the date column to appear in the Grid
' AddDateGridColumn("Creation Date", "Date", True)

Please note that if you add a new column to the Grid, then you will need to change the size of the ImageManager dialog. The Width and Height properties of the dialog can be set by using the code bellow (in the Default_Vb.aspx.vb file):
Copy Code
' This code sets the Width of the Image manager's dialog:
Dim imagePropertiesDialog As DialogDefinition = RadEditor1.GetDialogDefinition("ImageManager")
imagePropertiesDialog.Width = Unit.Pixel(1000)

I hope this helps.

Sincerely yours,
Rumen
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.
Tags
Editor
Asked by
Roger Chen
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or