ID of Transfer Button

6 posts, 0 answers
  1. Alok
    Alok avatar
    39 posts
    Member since:
    Feb 2009

    Posted 13 Jan 2012 Link to this post

    Hi there,

    How can i access the "Individual Buttons for transfer of data between two ListBox"
  2. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 13 Jan 2012 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Alok
    Alok avatar
    39 posts
    Member since:
    Feb 2009

    Posted 16 Jan 2012 Link to this post

    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>
    .
    .
    .
  5. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 16 Jan 2012 Link to this post

    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
  6. Alok
    Alok avatar
    39 posts
    Member since:
    Feb 2009

    Posted 17 Jan 2012 Link to this post

    Hi,

    still not working...
    can you pls test in your local machine.
  7. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 17 Jan 2012 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017