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

Can we bind file explorer control with one more field?

3 Answers 92 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Mahendra Sharma
Top achievements
Rank 1
Mahendra Sharma asked on 28 May 2010, 02:37 PM
Hi All,

I need to bind grid with a one more field like FileName and Size. Is it possible ?

I need to add a field with description name which is a provided by database table field and i want to add this field with Filename and Size.

I am using  DBContentProvider : FileBrowserContentProvider type provider.

Could you please help me ?

Thanks a lot in advance.

3 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 02 Jun 2010, 01:39 PM
Hello Mahendra,

I believe that this online demo will be of help.

Greetings,
Fiko
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
Mahendra Sharma
Top achievements
Rank 1
answered on 02 Jun 2010, 01:50 PM
Hi Fiko,

Thanks for your quick response.
I have made a change in "GetChildFiles" method just add an attribute with my required field( In highlighted text). It is working fine.

Could you please guide me is it a right way to add an attribute to add a column?


 private FileItem[] GetChildFiles(string _path)
        {
            try
            {
                DataRow[] childRows = DataServer.GetChildFileRows(_path);
                List<FileItem> files = new List<FileItem>();

                for (int i = 0; i < childRows.Length; i++)
                {
                    DataRow childRow = childRows[i];
                    string name = childRow["Name"].ToString();
                    string WebDescription = Convert.ToString(childRow["WebDescription"]);
                    if (IsExtensionAllowed(System.IO.Path.GetExtension(name)))
                    {
                        string itemFullPath = CombinePath(_path, name);

                        FileItem newFileItem = new FileItem(name,
                                                            Path.GetExtension(name),
                                                            (int)childRow["Size"],
                                                            itemFullPath,
                                                            GetItemUrl(itemFullPath),
                                                            string.Empty,
                                                            GetPermissions(itemFullPath)
                                                            );

                        newFileItem.Attributes.Add("Webdescription", WebDescription);
                        files.Add(newFileItem);

                    }
                }
                return files.ToArray();
            }
            catch (Exception)
            {
                return new FileItem[] { };
            }
        }


Many thanks

with regards
Mahendra
0
Fiko
Telerik team
answered on 07 Jun 2010, 11:56 AM
Hi Mahendra,

The approach that you use is very similar to the one shown in the provided online demo and it should work without any problems. If you experience any difficulties implementing a custom column in the RadFileExplorer's Grid, however, I recommend you to recheck the provided Custom Grid Columns demo and modify your code to look like the one used in the demo.

Greetings,
Fiko
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
FileExplorer
Asked by
Mahendra Sharma
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Mahendra Sharma
Top achievements
Rank 1
Share this question
or