I have the following code-block, which works fine:
It works like this: When I pull the top radSlider, it updates the numeric textbox with the value from the slider. This is cool - although, consider a scenario like the above, where I've added the second radSlider and a second numeric textbox. I would now like to use the same client-side eventhandler for this.
But as it shows, the ClientID for the textbox is hardcoded in the javascript (<%= NumericTextBox1.ClientID %>) and I can't figure out how to pass on the reference to the textbox to the eventhandler. I was thinking something like
and then retrieving this in someway in the eventhandler.
Any suggestions or solutions to this will be highly appreciated! Thank you for your time and your great webcontrols.
| <script language="javascript" type="text/javascript"> | |
| function HandleSliderValueChanged (sender, EventArgs) | |
| { | |
| $find('<%= NumericTextBox1.ClientID %>').SetValue(sender.get_value()); | |
| } | |
| </script> | |
| <telerik:radnumerictextbox id="NumericTextBox1" minvalue="1" maxvalue="50" width="20px" runat="server"> | |
| <NumberFormat DecimalDigits="0" /> | |
| </telerik:radnumerictextbox> | |
| <telerik:radnumerictextbox id="NumericTextBox2" minvalue="1" maxvalue="50" width="20px" runat="server"> | |
| <NumberFormat DecimalDigits="0" /> | |
| </telerik:radnumerictextbox> | |
| <telerik:radslider id="RadSlider1" OnClientValueChange="HandleSliderValueChanged" minimumvalue="1" maximumvalue="50" runat="server" /> | |
| <telerik:radslider id="RadSlider2" minimumvalue="1" maximumvalue="50" runat="server" /> |
It works like this: When I pull the top radSlider, it updates the numeric textbox with the value from the slider. This is cool - although, consider a scenario like the above, where I've added the second radSlider and a second numeric textbox. I would now like to use the same client-side eventhandler for this.
But as it shows, the ClientID for the textbox is hardcoded in the javascript (<%= NumericTextBox1.ClientID %>) and I can't figure out how to pass on the reference to the textbox to the eventhandler. I was thinking something like
| OnClientValueChange="HandleSliderValueChanged('<%= NumericTextBox1.ClientID %>')" |
and then retrieving this in someway in the eventhandler.
Any suggestions or solutions to this will be highly appreciated! Thank you for your time and your great webcontrols.