Call serverside event OnItemDblClick

4 posts, 0 answers
  1. Patrick
    Patrick avatar
    20 posts
    Member since:
    Feb 2008

    Posted 14 Mar 2011 Link to this post


    I have a treelist which shows an overview of all contentpages. I have implemented a editbutton in the treelisttemplate which will navigate the user to another page to edit the specific contentpage. I want to achieve the same result when the user doubleclick on a specific row in the treelist. I have achieved in with a single click (ClientSettings-AllowPostBackOnItemClick="true") but is this also possible on a doubleclick event (client)


  2. Veli
    Veli avatar
    2002 posts

    Posted 14 Mar 2011 Link to this post

    Hello Patrick,

    You can setup RadTreeList to fire the ItemClick command on double click instead of single click. To do that:

    1. Remove EnablePostBackOnItemClick to prevent postback from single clicks.
    2. Attach to the client-side OnItemDblClick event of RadTreeList:

            <ClientEvents OnItemDblClick="itemDblClick" />

    3. Use RadTreeList's client-side API to fire an ItemClick command:

    function itemDblClick(sender, args)
        sender.fireCommand("ItemClick", args.get_item().get_displayIndex());

    Note the above fireCommand function call. I pass the command name that I need the server-side ItemCommand event handler to fire for and I also pass the display index of my target item. Without the latter RadTreeList won't know which item fired the command. The result - I get RadTreeList's server-side ItemClick command firing on double click.

    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. DevCraft R3 2016 release webinar banner
  4. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 06 Apr 2013 Link to this post

    Hi All,

    @Telerik: Since I found tons of forum, blog and code library info for controls for using DblClick, why not implement this by standard, optional?

    To elaborate a bit more and to make the "RAD" come through for this matter; my solution:

    <telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
        <script type="text/javascript">
            // <![CDATA[        //
            function OnRadTreeList_Main_RowDblClick(sender, eventArgs) {
                //alert("RowDblClicked:" + eventArgs.get_item().get_dataKeyValue("ContactId"));
                sender.fireCommand("ItemDblClick", eventArgs.get_item().get_displayIndex());
            // ]]>
    <telerik:RadTreeList ID="RadTreeList_Main" ClientDataKeyNames="ContactId" DataKeyNames="ContactId" ParentDataKeyNames="ParentContactId" AutoGenerateColumns="false" ShowTreeLines="false" AllowSorting="True" GridLines="Vertical" runat="server" ItemStyle-Wrap="False">
        <ClientSettings AllowPostBackOnItemClick="false" >
            <ClientEvents OnItemDblClick="OnRadTreeList_Main_RowDblClick" />

    VB Code

    Private Sub RadTreeList_Main_ItemCommand(sender As Object, e As Telerik.Web.UI.TreeListCommandEventArgs) Handles RadTreeList_Main.ItemCommand
            If (e.CommandName & "").Trim.ToLower = "ItemDblClick".ToLower Then
                Dim DataItem As TreeListDataItem = CType(e.Item, TreeListDataItem)
                Dim lng_ContactId As Long = DataItem.GetDataKeyValue("ContactId")
            End If
        Catch ex As Exception
            If Diagnostics.Debugger.IsAttached Then Diagnostics.Debugger.Break()
        End Try
    End Sub

  5. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 10 Apr 2013 Link to this post

    Hi Erik,

    Thank you for sharing your solution.I'm sure it will be very useful for other users trying to implement the same functionality.
    Also you could log your request into our feedback portal below so that other users could vote for it and increase its priority:

    Maria Ilieva
    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