This is a migrated thread and some comments may be shown as answers.
RadTextBox onvaluechanged
2 Answers 42 Views
This is a migrated thread and some comments may be shown as answers.
newbie
Top achievements
Rank 1
newbie asked on 12 Jan 2010, 12:25 AM
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: 
http://www.telerik.com/community/forums/aspnet-ajax/input/radnumerictextbox-onvaluechanged-update-label-text.aspx

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?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 12 Jan 2010, 11:12 AM
Hello,

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.

Greetings,
Dimo
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.
0
newbie
Top achievements
Rank 1
answered on 13 Jan 2010, 12:59 AM
Thanks, that helped.
Tags
Input
Asked by
newbie
Top achievements
Rank 1
Answers by
Dimo
Telerik team
newbie
Top achievements
Rank 1
Share this question
or