Double-Click in RadListBox to Make ContextMenu Appear

2 posts, 0 answers
  1. Robert
    Robert avatar
    253 posts
    Member since:
    Aug 2007

    Posted 03 Dec 2011 Link to this post

    I have a RadListBox implemented thusly:

        <telerik:RadPane ID="radPaneLeft" runat="server" Scrolling="None" MinWidth="170" MaxWidth="300"><br>      <telerik:RadSlidingZone ID="radSlidingZone" runat="server" Width="22" Height="0" ClickToOpen="true" DockedPaneId="radSlidingPane"><br>        <telerik:RadSlidingPane ID="radSlidingPane" runat="server" BackColor="#F0F8FF" CssClass="slidingPane" TabView="TextAndImage" IconUrl="~/Images/hierarchy.gif"<br>                                DockOnOpen="true" OnClientDocked="radSlidingPane_Docked" OnClientUndocked="radSlidingPane_Undocked"><br>          <telerik:RadListBox ID="radListBoxStopes" runat="server" Width="100%" Height="100%" AutoPostBack="true" <br>                              OnItemCreated="radListBoxStopes_ItemCreated" OnSelectedIndexChanged="radListBoxStopes_SelectedIndexChanged"><br>            <ItemTemplate><br>              <asp:Panel runat="server"><br>                <asp:Label ID="labelStope" runat="server" Text='<%# Eval("Description") %>' CssClass="muckListPrimary" /><br /><br>                <asp:Label ID="labelUnits" runat="server" Text='<%# Eval("Units", "{0:0 units}") %>' CssClass="muckListSecondary" /><br>                <asp:HiddenField ID="hidFieldMaterial" runat="server" Value='<%# Eval("Material").ToString() %>' /><br>              </asp:Panel><br>            </ItemTemplate><br>          </telerik:RadListBox><br>          <telerik:RadContextMenu ID="radContextMenu_ListBoxStopes" runat="server" OnItemClick="radContextMenu_ListBoxStopes_Click"><br>            <Targets><br>              <telerik:ContextMenuControlTarget ControlID="radListBoxStopes" /><br>            </Targets>          <br>            <Items><br>              <telerik:RadMenuItem Text="Set as desktop" Value="D" /><br>              <telerik:RadMenuItem Text="Open in a new window" Value="W" /><br>            </Items><br>          </telerik:RadContextMenu><br>        </telerik:RadSlidingPane><br>      </telerik:RadSlidingZone><br>    </telerik:RadPane><br>

    I would like to be able to double-click on any item in the ListBox and have the ContextMenu appear.  I've tried several approaches to make this work but to no avail.

    How would I do it?

    Robert



  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Dec 2011 Link to this post

    Hello,

    Try the following javascript on OnClientItemDoubleClicked event of ListBox.
    JS:
    <script type="text/javascript">
    function OnClientItemDoubleClicked(sender, args)
         {
            var contextMenu = $find("<%= RadMenu1.ClientID %>");
            contextMenu.show(args);
         }
    </script>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top