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

Change NoMasterRecordsText

4 Answers 74 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 10 Mar 2012, 06:51 PM
Does anyone know if it is possible to change the NoMasterRecordsText property from No Records to Display to something else PER FOLDER?  So in the tree view you would have multiple folders and when the user clicks a folder I want to display Access Denied for ones they have no access to and This Folder is Empty for folders that simply have nothing in them.  Has anyone done anything like this?

4 Answers, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 14 Mar 2012, 04:05 PM
Hello Adam,

You should handle the folderLoaded client-side event of the RadFileExplorer, and set the respective text using JavaScript. Here is an example doing this:
<div>
    <telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" OnClientFolderLoaded="OnClientFolderLoaded"
        Height="600" Width="900">
    </telerik:RadFileExplorer>
</div>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function OnClientFolderLoaded(sender, args)
        {
            SetEmptyRecord(sender, "Some Text");
        }
 
        function SetEmptyRecord(fe, text)
        {
            var grid = fe.get_grid();
            var $ = $telerik.$;
            $("#" + grid.get_id() + " tr.rgNoRecords td div").html(text);
        }
    </script>
</telerik:RadCodeBlock>

However to hide the folders and files for the users that do not have enough permissions, you need to use custom content provider (inherit from the default FileSystemContentProvider) and override the ResolveDirectory and ResolveDirectoryAsTree methods.

Greetings,
Pero
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Adam
Top achievements
Rank 1
answered on 14 Mar 2012, 06:10 PM
I am using the customcontentprovider and I am already overriding those methods and hiding completely files and folders that the user does not have access to however I'm not sure how your solution would work.

Say you have two folders.  One the user has access to which when they click it will show all files and subfolders however this folder is empty.  The other the user is denied access so when they click nothing shows up.

Currently when you click on either of these folders the message says "No records to display".  I want the first folder to show "This folder is empty".  I want the second folder, the denied access one, to show "Access is denied". 

Make sense?  Is this possible?
0
Accepted
Dobromir
Telerik team
answered on 19 Mar 2012, 02:11 PM
Hi Adam,

If I understand you correctly, you have already handled the case for hiding the folders when users do not have enough permissions, and now you need to display different "no records text" according to the users permissions.

If this is the case, I will have to disappoint you, because this cannot be achieved with RadFileExplorer. The problem comes from the fact that the explorer is populated using callbacks and it is not possible to pass additional information from the server to distinct if the user have permissions to this specific folder or not.

All the best,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Adam
Top achievements
Rank 1
answered on 19 Mar 2012, 02:14 PM
Ok, not a huge deal but thank you for your help.  Maybe that could be a feature request.

Thanks,
Adam
Tags
FileExplorer
Asked by
Adam
Top achievements
Rank 1
Answers by
Pero
Telerik team
Adam
Top achievements
Rank 1
Dobromir
Telerik team
Share this question
or