Disable Double Clicks on Items

3 posts, 2 answers
  1. Robert
    Robert  avatar
    68 posts
    Member since:
    Feb 2009

    Posted 16 Nov 2011 Link to this post

    Is a setting available for the RadFileExplorer which will allow for only single clicks on items, rather than allowing a double click on a given item?

    The EnableOpenFile-"False" property is set on the RadFileExplorer, but this does not disallow double clicking;

    Any insight is appreciated;  Best regards - Rob
  2. Answer
    Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 17 Nov 2011 Link to this post

    Hello,

    Method 1 :
    <telerik:RadFileExplorer runat="server" ID="FileExplorer1" Width="520px" Height="520px"
              OnClientFileOpen="ClientFileOpen">
              <Configuration ViewPaths="~/Pictures/" />
          </telerik:RadFileExplorer>
    <script type="text/javascript">
         function ClientFileOpen(sender, eve) {
             eve._cancel = true;
         }
     </script>


    Method 2:

    <telerik:RadFileExplorer runat="server" ID="FileExplorer1" Width="520px" Height="520px"
                EnableOpenFile="false">
                <Configuration ViewPaths="~/Pictures/" />
            </telerik:RadFileExplorer>


    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 21 Nov 2011 Link to this post

    Hi Rob,

    The EnableFileOpen property of RadFileExplorer is controlling if the preview window (or the download dialog) should appear when a file is opened.

    The Method 1 of the Jayesh's post is the way to disable the doubleclick in the Grid component of RadFileExplorer.

    I just wanted to point out that in the posted handler a private property is used, which is not recommended. You should use its setter instead set_cancel(). Also, this will disable the doubleclick on a folder and will prevent navigation. You can check if the clicked item is file or folder using the isDirectory() method, e.g.:
    <telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" EnableOpenFile="false" OnClientFileOpen="OnClientFileOpen">
        <Configuration ViewPaths="~/ROOT" />
    </telerik:RadFileExplorer>
     
    <script type="text/javascript">
        function OnClientFileOpen(explorer, args)
        {
            if (!args.get_item().isDirectory())//check if the clicked item is a folder
                args.set_cancel();
        }
    </script>


    Best wishes,
    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
Back to Top