RadTextBox onvaluechanged

3 posts, 0 answers
  1. newbie
    newbie avatar
    355 posts
    Member since:
    Feb 2008

    Posted 11 Jan 2010 Link to this post

    On my page I have some text boxes along with a corresponding checkbox.
    If the user enters some value in the textbox i want to select the checkbox and deselect if the user deletes the text.

    I was able to get the functionality working for one textbox at a time by referring to this thread: 

    However, I want to write a single function that can be called for all the textboxes.
    All my textboxes and checkboxes have similar naming convention. Like my textboxes are named TextBox1, textBox2, textBox3 and my checkboxes are named CheckBox1, checkbox2, checkbox3.

    Can you help me with an example to achieve this?

  2. Dimo
    Dimo avatar
    8482 posts

    Posted 12 Jan 2010 Link to this post


    If there is a predictable relationship between the client IDs of the textboxes and checkboxes, then you can use the following:

    1. in the ValueChanged client handler obtain the client ID of the textbox with  sender.get_id()
    2. in the new variable replace "textbox" with "checkbox" - and you now have the checkbox ID

    function MyHandler(sender, args)
            var textboxID = sender.get_id();

    In this way, you will be able to use the same function for all controls and what's more, to move the script in an external file.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. newbie
    newbie avatar
    355 posts
    Member since:
    Feb 2008

    Posted 12 Jan 2010 Link to this post

    Thanks, that helped.
Back to Top