I have reviewed several resources while trying to programmatically control whether a user should be allowed to rename an item in RadFileExplorer. Here are a couple of the resources that I have reviewed:
- RadFileExplorer's server-side properties for handling client-side events
- Renaming File, disallow extensions, cancel move
The FileExplorer on my web page has a root folder. Under the root folder, I populate the explorer with “home folders”; this is done during the Page_Load event. You can think of the home folders like Windows Profiles. When a user logs into Windows, they have access to the folders that are associated with their profile. I am doing a similar thing with file explorer. When a user logs into my website, they have access to their home folder, its files, and its subdirectories. They do not have access to home folders that belong to other users and file explorer is configured so that it will not let a user see the home folders of other users.
As you know, FileExplorer allows you to right-click on a file or folder, and click Rename. That is cool and it saves a lot of development time. In my web page, I allow users to rename anything they want. But I do not want them to be able to rename their home folder.
My RadFileExplorer contains the following setting (among others): OnClientMove="fncMoveOrRename". My intent is to use this function that you see referenced here as a way to check whether the currently selected item in FileExplorer is a home folder vs. any other file or folder. If it’s a home folder, then cancel is set to true. But even when cancel is set to true, the rename still occurs. Is the documentation that I referenced above correct? I should be able to prevent a rename by canceling the OnClientMove, right?
To determine if the problem had anything to do with my logic, I stripped everything out of fncMoveOrRename, and I am left with the following:
function fncMoveOrRename(objExplorer, eventArgs) {
alert("Click OK to cancel.");
eventArgs.set_cancel(true);
}
When I rename a folder, the alert message appears, and I click OK. But cancel is never triggered. I still have the undesirable effect of having the folder renamed even though cancel is set to true. What am I missing here?
Thank you,
Steven