This is a migrated thread and some comments may be shown as answers.

ID of Transfer Button

5 Answers 84 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Alok
Top achievements
Rank 2
Alok asked on 13 Jan 2012, 09:15 AM
Hi there,

How can i access the "Individual Buttons for transfer of data between two ListBox"

5 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 13 Jan 2012, 05:21 PM
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:
$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>
.
.
.
0
Bozhidar
Telerik team
answered on 16 Jan 2012, 05:39 PM
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
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.
0
Bozhidar
Telerik team
answered on 17 Jan 2012, 05:44 PM
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:
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
Tags
ListBox
Asked by
Alok
Top achievements
Rank 2
Answers by
Bozhidar
Telerik team
Alok
Top achievements
Rank 2
Share this question
or