We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Rename Dialog popup field

Hi, everyone.

Is there a way I can get the contents (the button and input field) of the rename popup dialog from FileManager for ASP.NET Core?

If it can be done with JavaScript, please let me know


Thanks in advance!


4 Replies 1 reply marked as answer

FA Farai October 6, 2022 11:46 AM UTC

Got it. If anyone out there comes to this problem, what you can do is use popUpOpen or popUpClose FileManager

methods in JavaScript to get HTML div element of the rename popup dialog and get the input field or button contents like so:

    function popUpClose(args){
        if (args.popupName == 'Rename') { 
            var arr = [].slice.call(args.popupModule.element.getElementsByTagName('input'));
            alert(arr[0].value); 
        } 
    }


It's an ugly way to do it, but you get the gist of it.



PM Prasanth Madhaiyan Syncfusion Team October 6, 2022 02:46 PM UTC

Hi Farai,


Greetings from Syncfusion support.


Thanks for the suggestion. You can also fetch this using the success event to get the renamed files or folder names.


Please refer to the code snippet.


[index.cshtml]

 

<ejs-filemanager id="filemanager" created="onCreated" success="onSuccess" >

    <e-filemanager-ajaxsettings url=https://ej2-aspcore-service.azurewebsites.net/api/FileManager/FileOperations

                                downloadUrl=https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Download

                                uploadUrl=https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Upload

                                getImageUrl=https://ej2-aspcore-service.azurewebsites.net/api/FileManager/GetImage>

    </e-filemanager-ajaxsettings>

</ejs-filemanager>

 

<script>

       

    function onSuccess(args){

        if(args.action=="rename"){

            console.log(args.result.files[0].name);

        }

    }

</script>


For your reference, we have attached the sample.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/CoreFileManagerSample834032505.zip


Please check the shared sample and let us know if you need any further assistance.


Regards,

Prasanth Madhaiyan.


Marked as answer

FA Farai October 7, 2022 10:25 AM UTC

Hi,  Prasanth Madhaiyan


Thank you! Your solution is way better than mine lol. I've marked yours as the answer.



IL Indhumathy Loganathan Syncfusion Team October 10, 2022 07:21 AM UTC

Hi Farai,


We are glad that the shared solution is suitable for you. Please get back to us if you need any further assistance.


Regards,

Indhumathy L


Loader.
Live Chat Icon For mobile
Up arrow icon