Change NoMasterRecordsText

5 posts, 1 answers
  1. Adam
    Adam avatar
    19 posts
    Member since:
    Dec 2011

    Posted 10 Mar 2012 Link to this post

    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?
  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 14 Mar 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adam
    Adam avatar
    19 posts
    Member since:
    Dec 2011

    Posted 14 Mar 2012 Link to this post

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

    Posted 19 Mar 2012 Link to this post

    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.
  6. Adam
    Adam avatar
    19 posts
    Member since:
    Dec 2011

    Posted 19 Mar 2012 Link to this post

    Ok, not a huge deal but thank you for your help.  Maybe that could be a feature request.

    Thanks,
    Adam
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017