I use Custom provider.
Step to reproduce:
Create folder with name like: !@#$%^&&&^*()_+~|":}{?><,./;'[]\=-0987654321`
after clicking on that folder i get an error:
Callback Loading error: ...Should be like in demo: invalid
should be like in demo: alert with text.
Step to reproduce:
Create folder with name like: !@#$%^&&&^*()_+~|":}{?><,./;'[]\=-0987654321`
after clicking on that folder i get an error:
Callback Loading error: ...Should be like in demo: invalid
should be like in demo: alert with text.
7 Answers, 1 is accepted
0

Roman
Top achievements
Rank 1
answered on 13 Mar 2012, 11:24 AM
The same problem with renaming files.
When i try to rename file with symbol "/" for example "aaa/aaa" fileexplorer gets an error path permission.
I guess it because that i try to create file in another directory (root/upload/aaa), but we have permission to upload files only into root/upload.
How can i validate file name before sending to (server)provider?
Thanks
When i try to rename file with symbol "/" for example "aaa/aaa" fileexplorer gets an error path permission.
I guess it because that i try to create file in another directory (root/upload/aaa), but we have permission to upload files only into root/upload.
How can i validate file name before sending to (server)provider?
Thanks
0

Roman
Top achievements
Rank 1
answered on 14 Mar 2012, 11:01 AM
Can you also help me how to set maxlength in creating new folder or renaming file/folder.
Thanks
Thanks
0
Hello Roman,
To validate the name of the newly created folder I would suggest handling the "createNewFolder" client-side event (OnClientCreateNewFolder property) and checking the name. The args.get_newPath() method will return you the new name of the folder.
Renaming a file or folder is actually moving the same file or folder, so that's why you should handle the "move" client-side event to validate the file name. To distinguish between move and rename you should handle the "rowDropping" event of the grid, and "nodeDropping" of the treeview.
For your convenience I have created a sample project demonstrating this approach for validation. I hope it helps.
Regards,
Pero
the Telerik team
To validate the name of the newly created folder I would suggest handling the "createNewFolder" client-side event (OnClientCreateNewFolder property) and checking the name. The args.get_newPath() method will return you the new name of the folder.
function
OnCreateFolder(sender, args)
{
alert(
"Folder name: "
+ args.get_newPath());
}
Renaming a file or folder is actually moving the same file or folder, so that's why you should handle the "move" client-side event to validate the file name. To distinguish between move and rename you should handle the "rowDropping" event of the grid, and "nodeDropping" of the treeview.
For your convenience I have created a sample project demonstrating this approach for validation. I hope it helps.
Regards,
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

Roman
Top achievements
Rank 1
answered on 21 Mar 2012, 04:40 PM
Thanks for help.
Can i avoid typing more then for example 20 symbols?
Just like setting maxlength for input.
Thanks.
Can i avoid typing more then for example 20 symbols?
Just like setting maxlength for input.
Thanks.
0
Hi Roman,
You can achieve the required functionality using the following JavaScript.
An alternative solution to this case would be to customize the prompts template of the RadWindowManager used in the explorer. You can find how to achieve this in the following KB article:
Change the templates of the predefined dialogs (radalert, radconfirm and radprompt)
Kind regards,
Dobromir
the Telerik team
You can achieve the required functionality using the following JavaScript.
<telerik:RadFileExplorer ID=
"RadFileExplorer1"
runat=
"server"
OnClientLoad=
"explorerLoad"
>
<Configuration ViewPaths=
"~/ROOT"
UploadPaths=
"~/ROOT"
DeletePaths=
"~/ROOT"
/>
</telerik:RadFileExplorer>
<script type=
"text/javascript"
>
function
explorerLoad(explorer)
{
//assign handler to the window manager's show handler
explorer.get_windowManager().add_show(showHandler);
}
function
showHandler(wnd, args)
{
if
(wnd.get_title() ==
"Rename"
)
//check if the opened window is the Rename dialog
$telerik.$(
".rwDialogInput"
, wnd.get_contentElement()).bind(
"keydown"
,
function
(e)
//handle inputs keydown event
{
//check if the text in the input is less than 20 symbols and if enter, esc, backspace, delete keys pressed
if
(e.target.value.length >= 20 && e.keyCode != 13 && e.keyCode != 27 && e.keyCode != 8 && e.keyCode != 46)
$telerik.cancelRawEvent(e);
//cancel the key press event
});
}
</script>
An alternative solution to this case would be to customize the prompts template of the RadWindowManager used in the explorer. You can find how to achieve this in the following KB article:
Change the templates of the predefined dialogs (radalert, radconfirm and radprompt)
Kind regards,
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

Roman
Top achievements
Rank 1
answered on 28 Mar 2012, 12:41 PM
Hi Dobromir.
Thanks for help.
What if we have several localizations ?
Thanks for help.
What if we have several localizations ?
0
Hi Roman,
You can get the localized value of the "Rename" string using the explorer's get_localization() client-side meethod, e.g.:
Greetings,
Dobromir
the Telerik team
You can get the localized value of the "Rename" string using the explorer's get_localization() client-side meethod, e.g.:
function
showHandler(wnd, args)
{
var
explorer = $find(
"<%=RadFileExplorer.ClientID%>"
);
//get reference to the explorer's client-side object
if
(wnd.get_title() == explorer.get_localization()[
"Rename"
])
//check if the opened window is the Rename dialog
........
}
Greetings,
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.