extra arguments for "telerik events"

2 posts, 0 answers
  1. Laurens
    Laurens avatar
    12 posts
    Member since:
    Sep 2013

    Posted 14 Oct 2013 Link to this post

    Hello,

    Is there a way to have events, such as RadDatePicker.ClientEvents.OnDateSelected or RadListBox.OnClientSelectedIndexChanged, handle functions with arguments, apart from "sender" and "eventArgs"?
    The following code doesn't do it completely right:

    RadListBox rlb = new RadListBox();
    rlb.OnClientSelectedIndexChanged = "ToSomething('Aaa', 'Bbb', 'Ccc')";
    function DoSomething(a, b, c)
    {
       //code
    }

    Thanks in advance.
  2. Laurens
    Laurens avatar
    12 posts
    Member since:
    Sep 2013

    Posted 14 Oct 2013 Link to this post

    Never mind, I found the answer here: 

    http://www.telerik.com/community/code-library/aspnet-ajax/button/passing-user-defined-parameters-to-client-side-event-handlers.aspx

    In short, this does the trick:

    rlb.OnClientSelectedIndexChanged = "function(sender, args){DoSomething('Aaa', 'Bbb', 'Ccc')}";
Back to Top