How to check the rad gridview selected item is file or folder in RAD File explorer

4 posts, 0 answers
  1. sandhya
    sandhya avatar
    12 posts
    Member since:
    May 2011

    Posted 24 Jun 2011 Link to this post


    This is my requirement

    I want to disable the DownloadFile option  if i click on folder and once i select the folder if no records are there in grid that time also it should disable downloadFile option.
    If click on file DownloadFile option shuld be enable
    All these things happen rad gridview context menu shown and file or folder click.
    Note:DownloadFile i added custom button.

    i have done like this for if no records are there to display in gridview.But in case of if click on folder i want to disable download option and if i click on file download file option shuld be enable.



    function OnClientShown(oMenu, args) {




    var iCount =0;




    var deleteMenuItem = oMenu.findItemByValue("Delete");




    var radExplorer = $find("<%# radFileExplorer.ClientID %>");




    var getGrid = radExplorer.get_grid();




    var table = getGrid.get_masterTableView();




    var rows = table.get_dataItems();




    var downloadFileItem = oMenu.findItemByValue("Download_File");




    if (rows.length == 0) {














    Please can u solve this prob.

  2. Dobromir
    Dobromir avatar
    1633 posts

    Posted 28 Jun 2011 Link to this post

    Hi Sandhya,

    You can use RadFileExplorer's get_selectedItem() client-side method to get reference to the currently selected FileExplorerItem, then you can check if this item is file or folder using its isDirectory() method, e.g.:
    var radExplorer = $find("<%# radFileExplorer.ClientID %>");
    var selectedItem = radExplorer.get_selectedItem();
        alert("Selected Item is a Folder");
        alert("Selected Item is a File");

    I hope this helps.

    Kind regards,
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Rohan
    Rohan avatar
    94 posts
    Member since:
    Jul 2012

    Posted 23 Jul 2012 Link to this post

    Hi Dobromir,
    thanks for replay ...
    How to detect whether folder is empty or not , when user click on the folder  or event(OnGridClientShowing)?
  4. Dobromir
    Dobromir avatar
    1633 posts

    Posted 25 Jul 2012 Link to this post

    Hi Rohan,

    I am not quite sure I understand the exact question. Could you please describe in more detail when exactly do you need to check if a folder is empty?

    You can check if the currently loaded folder is empty by examining the number of items of the fileList, e.g.:
    if(explorer.get_fileList().get_items().length == 0)
        alert("Folder is empty");

    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.
Back to Top