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

extra arguments for "telerik events"

1 Answer 32 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Laurens
Top achievements
Rank 1
Laurens asked on 14 Oct 2013, 10:06 AM
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.

1 Answer, 1 is accepted

Sort by
0
Laurens
Top achievements
Rank 1
answered on 14 Oct 2013, 02:45 PM
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')}";
Tags
General Discussions
Asked by
Laurens
Top achievements
Rank 1
Answers by
Laurens
Top achievements
Rank 1
Share this question
or