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

Adding Extra Arguments to Javascript functions

1 Answer 76 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Alperozgur
Top achievements
Rank 1
Alperozgur asked on 02 Mar 2010, 02:27 PM
Hi;
I have an user control in an aspx page. I had find a sample that can be use as autocomplete function at listbox.
In user control i had 3 search textboxes, and 3 listboxes. And the javascript code as follows:
<script type="text/javascript">
    function filterListBox(sender, e) {
        var list = $find("<%= RadListBox1.ClientID %>");
        var searchText = sender.get_value() + e.get_keyCharacter();
        var items = list.get_items();
        for (var i = 0; i < items.get_count(); i++) {
            var item = items.getItem(i);
            if (item.get_text().toLowerCase().startsWith(searchText.toLowerCase())) {
                item.select();
            }
        }
    }
</script>       
I don't want to write 2 more same javascript code block. And i decide to send the controls names to the javascript too. But as i see the sender and e arguments generating by telerik. And i can't add more arguments.
How can i add two more arguments into this javascript?

1 Answer, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 02 Mar 2010, 02:49 PM
Hi Alperozgur,

You cannot send more arguments to the function, but you have the textbox which fires the event, so you can find which listbox to update according to it.

Best regards,
Yana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ListBox
Asked by
Alperozgur
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or