Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListBox > ID of Transfer Button

Not answered ID of Transfer Button

Feed from this thread
  • Alok avatar

    Posted on Jan 13, 2012 (permalink)

    Hi there,

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

    Reply

  • Bozhidar Bozhidar admin's avatar

    Posted on Jan 13, 2012 (permalink)

    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

    Reply

  • Alok avatar

    Posted on Jan 16, 2012 (permalink)

    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>
    .
    .
    .

    Reply

  • Bozhidar Bozhidar admin's avatar

    Posted on Jan 16, 2012 (permalink)

    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

    Reply

  • Alok avatar

    Posted on Jan 17, 2012 (permalink)

    Hi,

    still not working...
    can you pls test in your local machine.

    Reply

  • Bozhidar Bozhidar admin's avatar

    Posted on Jan 17, 2012 (permalink)

    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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListBox > ID of Transfer Button