I've spent several hours and multiple approaches to implement both single-clicking and double-clicking in the same listbox. The results of my testing indicate that it's not possible.
Is this a known bug/deficiency with your listbox?
Robert
Is this a known bug/deficiency with your listbox?
Robert
4 Answers, 1 is accepted
0
Hello Robert,
Regards,
Bozhidar
the Telerik team
To implement double-clicking in a listbox, try the following approach:
$telerik.$(window).bind(
'load'
,
function
() {
var
timer;
$telerik.$(
"#RadListBox1"
)
.bind(
'click'
,
function
(){
if
(timer) clearTimeout(timer);
timer = setTimeout(
function
() { alert(
'Single'
); }, 250);
})
.bind(
'dblclick'
,
function
(){
clearTimeout(timer);
alert(
'Double'
);
});
});
Regards,
Bozhidar
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
0
Robert
Top achievements
Rank 1
answered on 12 Dec 2011, 09:31 PM
Bozhidar,
Most interesting approach!
In a test fashion, I just implemented it and it seems to work. Thank you!
Robert
Most interesting approach!
In a test fashion, I just implemented it and it seems to work. Thank you!
Robert
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %><
br
><
br
><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><
br
><
br
><
html
xmlns
=
"http://www.w3.org/1999/xhtml"
><
br
><
head
runat
=
"server"
><
br
> <
title
></
title
><
br
> <
telerik:RadStyleSheetManager
id
=
"RadStyleSheetManager1"
runat
=
"server"
/><
br
></
head
><
br
><
body
><
br
> <
form
id
=
"form1"
runat
=
"server"
><
br
> <
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
><
br
> <
Scripts
><
br
> <%--Needed for JavaScript IntelliSense in VS2010--%><
br
> <%--For VS2008 replace RadScriptManager with ScriptManager--%><
br
> <
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/><
br
> <
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/><
br
> <
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/><
br
> </
Scripts
><
br
> </
telerik:RadScriptManager
><
br
><
br
> <
script
type
=
"text/javascript"
><
br
> $telerik.$(window).bind('load', function() {<
br
> var timer;<
br
><
br
> $telerik.$("#RadListBox1")<
br
> .bind('click', function() {<
br
> if (timer) clearTimeout(timer);<
br
> timer = setTimeout(function() { alert('Single'); }, 250);<
br
> })<
br
> .bind('dblclick', function() {<
br
> clearTimeout(timer);<
br
> alert('Double');<
br
> });<
br
> });<
br
> </
script
><
br
><
br
> <
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
/><
br
><
br
> <
div
><
br
> <
telerik:RadListBox
ID
=
"RadListBox1"
runat
=
"server"
><
br
> <
Items
><
br
> <
telerik:RadListBoxItem
Text
=
"A1"
Value
=
"0"
/><
br
> <
telerik:RadListBoxItem
Text
=
"B2"
Value
=
"1"
/><
br
> <
telerik:RadListBoxItem
Text
=
"C3"
Value
=
"2"
/><
br
> </
Items
><
br
> </
telerik:RadListBox
><
br
> </
div
><
br
> </
form
><
br
></
body
><
br
></
html
><
br
>
0
Robert
Top achievements
Rank 1
answered on 12 Dec 2011, 10:17 PM
Bozhidar,
Beyond my test project I'm now trying to implement your code into my actual project. It's somewhat more involved in that I'm performing a "__doPostBack".
I was able to wire up one half of the equation thusly:
<telerik:RadListBox ID="radListBoxStopes" runat="server" OnClientItemDoubleClicked="rlbDoubleClicked" >
But I'm stuck in regard to the single-click syntax. As you know, there's no "OnClientItemClicked" so I tried "OnClientItemChecked" but that doesn't work. I also tried "onclick" but that doesn't work either.
Any suggestions about what to place within the RadListBox definition above?
Robert
Beyond my test project I'm now trying to implement your code into my actual project. It's somewhat more involved in that I'm performing a "__doPostBack".
I was able to wire up one half of the equation thusly:
<telerik:RadListBox ID="radListBoxStopes" runat="server" OnClientItemDoubleClicked="rlbDoubleClicked" >
But I'm stuck in regard to the single-click syntax. As you know, there's no "OnClientItemClicked" so I tried "OnClientItemChecked" but that doesn't work. I also tried "onclick" but that doesn't work either.
Any suggestions about what to place within the RadListBox definition above?
Robert
0
Robert
Top achievements
Rank 1
answered on 12 Dec 2011, 10:22 PM
Solved it!!!
<telerik:RadListBox ID="radListBoxStopes" runat="server" OnClientSelectedIndexChanged="rlbClicked" OnClientItemDoubleClicked="rlbDoubleClicked">
<telerik:RadListBox ID="radListBoxStopes" runat="server" OnClientSelectedIndexChanged="rlbClicked" OnClientItemDoubleClicked="rlbDoubleClicked">