如何从ASP.NET AJAX控件工具包使用JavaScript功能设置滑块控件的值? [英] How to set Slider control Value from ASP.NET AJAX Control Toolkit with JavaScript function?
本文介绍了如何从ASP.NET AJAX控件工具包使用JavaScript功能设置滑块控件的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从ASP.NET AJAX控件工具包使用JavaScript功能设置滑块控件的值?
这甚至可能?
How to set Slider control Value from ASP.NET AJAX Control Toolkit with JavaScript function? Is this even possible?
推荐答案
当然是!你必须设置 ASP的值:文本框
一个与你的 SliderExtender
关联到你想要的值控制。因此,对于这个ASP标记:
Sure is! You have to set the value of asp:TextBox
control that's associated with your SliderExtender
to the value that you want. So for this ASP markup:
<asp:TextBox ID="sliderBox" runat="server" ClientIDMode="Static"></asp:TextBox>
<asp:SliderExtender ID="sliderBox_SliderExtender" runat="server" Enabled="True"
Maximum="100" Minimum="0" TargetControlID="sliderBox">
</asp:SliderExtender>
<asp:Button ID="incButton" runat="server" Text="incrementSlider"
onclientclick="change();" />
这基本上是:
- 的
ASP:文本框
命名sliderBox(为SliderExtender
来使用) - 的
ASP:SliderExtender
sliderBox_SliderExtender(含基本
默认值) - 的
ASP:按钮
命名incButton。这有一个调用变革的
JavaScript函数的OnClientClick
属性()
- an
asp:TextBox
named sliderBox (for theSliderExtender
to use) - an
asp:SliderExtender
sliderBox_SliderExtender (with basically default values) - an
asp:Button
named incButton. This has anonClientClick
property that calls thechange()
javascript function
这里是更改()
功能:
<script type="text/javascript">
function change() {
document.getElementById("sliderBox").value += 10;
}
</script>
的更改()
函数递增在 ASP值:10文本框
控制,从而增加了滑块每次定位单击该按钮。
The change()
function increments the value in the asp:TextBox
control by 10, thus increasing the sliders position each time you click the button.
这篇关于如何从ASP.NET AJAX控件工具包使用JavaScript功能设置滑块控件的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文