5 Answers, 1 is accepted
0
Hi Alok,
Each button has a specific class, that you can use to get the button and trigger a click. Here's an example on how to achieve this:
You can see the classes in the rendered html of the page. Also, here is a list of all the buttons and their individual classes:
rlbMoveUp, rlbMoveDown, rlbDelete, rlbTransferFrom, rlbTransferTo, rlbTransferAllFrom, rlbTransferAllTo
Note, that when the button is disabled, the class name changes, for instance rlbTransferAllFrom changes to rlbTransferAllFromDisabled.
Regards,
Bozhidar
the Telerik team
Each button has a specific class, that you can use to get the button and trigger a click. Here's an example on how to achieve this:
$telerik.$(
".rlbTransferAllFrom"
).click();
You can see the classes in the rendered html of the page. Also, here is a list of all the buttons and their individual classes:
rlbMoveUp, rlbMoveDown, rlbDelete, rlbTransferFrom, rlbTransferTo, rlbTransferAllFrom, rlbTransferAllTo
Note, that when the button is disabled, the class name changes, for instance rlbTransferAllFrom changes to rlbTransferAllFromDisabled.
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
Alok
Top achievements
Rank 2
answered on 16 Jan 2012, 10:37 AM
Hi Bozhidar,
I am using below code snippet....But its not working.
<script type="text/javascript">
$(document).ready(function(){
$telerik.$(".rlbTransferFrom").click(function () {
alert("Testing!");
//event.preventDefault();
});
});
</script>
.
.
.
I am using below code snippet....But its not working.
<script type="text/javascript">
$(document).ready(function(){
$telerik.$(".rlbTransferFrom").click(function () {
alert("Testing!");
//event.preventDefault();
});
});
</script>
.
.
.
0
Hello Alok,
Try attaching the click event in the OnClientLoad event of the RadListBox. That should solve the issue.
All the best,
Bozhidar
the Telerik team
Try attaching the click event in the OnClientLoad event of the RadListBox. That should solve the issue.
All the best,
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
Alok
Top achievements
Rank 2
answered on 17 Jan 2012, 07:18 AM
Hi,
still not working...
can you pls test in your local machine.
still not working...
can you pls test in your local machine.
0
Hi Alok,
Please excuse me for my last reply. It seems that I didn't test the listboxes thoroughly enough. The problem comes from the fact that at the time of the binding, the buttons are disabled. In this state they have different classes than the ones used in the binding expression, so the event isn't attached. When I tested the solution the previous time, I had an item already selected from the server, so the TransferFrom button was enabled, which made it look like the workaround was working.
Here's a list of the modified binding functions, which can be used to bind a click event to every one of the buttons, regardless of their enabled state at the time of binding:
I used the pageLoad event here, but any event in which the listboxes are already rendered will suffice.
All the best,
Bozhidar
the Telerik team
Please excuse me for my last reply. It seems that I didn't test the listboxes thoroughly enough. The problem comes from the fact that at the time of the binding, the buttons are disabled. In this state they have different classes than the ones used in the binding expression, so the event isn't attached. When I tested the solution the previous time, I had an item already selected from the server, so the TransferFrom button was enabled, which made it look like the workaround was working.
Here's a list of the modified binding functions, which can be used to bind a click event to every one of the buttons, regardless of their enabled state at the time of binding:
function
pageLoad() {
$telerik.$(
".rlbButton[title='To Right']"
).click(
function
() {
if
($telerik.$(
this
).hasClass(
"rlbTransferFrom"
))
alert(
"to right"
);
});
$telerik.$(
".rlbButton[title='To Left']"
).click(
function
() {
if
($telerik.$(
this
).hasClass(
"rlbTransferTo"
))
alert(
"to left"
);
});
$telerik.$(
".rlbButton[title='Move Up']"
).click(
function
() {
if
($telerik.$(
this
).hasClass(
"rlbMoveUp"
))
alert(
"moved up"
);
});
$telerik.$(
".rlbButton[title='Move Down']"
).click(
function
() {
if
($telerik.$(
this
).hasClass(
"rlbMoveDown"
))
alert(
"moved down"
);
});
$telerik.$(
".rlbButton[title='Delete']"
).click(
function
() {
if
($telerik.$(
this
).hasClass(
"rlbDelete"
))
alert(
"deleted"
);
});
$telerik.$(
".rlbButton[title='All to Right']"
).click(
function
() {
if
($telerik.$(
this
).hasClass(
"rlbTransferAllFrom"
))
alert(
"all to right"
);
});
$telerik.$(
".rlbButton[title='All to Left']"
).click(
function
() {
if
($telerik.$(
this
).hasClass(
"rlbTransferAllTo"
))
alert(
"all to left"
);
});
}
I used the pageLoad event here, but any event in which the listboxes are already rendered will suffice.
All the best,
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