Adding Extra Arguments to Javascript functions

2 posts, 1 answers
  1. Alperozgur
    Alperozgur avatar
    3 posts
    Member since:
    Sep 2006

    Posted 02 Mar 2010 Link to this post

    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?
  2. Answer
    Yana
    Admin
    Yana avatar
    4554 posts

    Posted 02 Mar 2010 Link to this post

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