ajax滑块和Javascript

时间:2011-04-16 12:06:42

标签: c# javascript asp.net ajaxcontroltoolkit

重写以使事情变得简单,并让我理解我需要......

我想知道如何更新Ajax Control Toolkits Maximum值以及如何获取其中一个滑块的当前值。这一切都应该在客户端完成。

理念是这样的:

int Used      = 0
int max       = 325
int Remainder = max - Used

slider1.maximum = Remainder
slider2.maximum = Remainder
slider3.maximum = Remainder

slider1.value = 0
slider2.value = 0
slider3.value = 0

slider1.Setvalue = 150
   Used = 150
   Remainder = 175
   slider1.maximum = Remainder   + slider1.value 
            Becoming 175         + 150
   Slider2.maximum = Remainder   + slider2.value
            Becoming 175         + 0
   Slider3.maximum = Remainder   + slider3.value
            Becoming 175         + 0

slider2.Setvalue = 50
   Used = 200
   Remainder = 125
   slider1.maximum = Remainder   + slider1.value 
            Becoming 125         + 150
   Slider2.maximum = Remainder   + slider2.value
            Becoming 125         + 50
   Slider3.maximum = Remainder   + slider3.value
            Becoming 125         + 0

slider3.Setvalue = 125
   Used = 325
   Remainder = 0
   slider1.maximum = Remainder   + slider1.value 
            Becoming 0           + 150
   Slider2.maximum = Remainder   + slider2.value
            Becoming 0           + 50
   Slider3.maximum = Remainder   + slider3.value
            Becoming 0           + 125         

Slider1.Setvalue = 125
   Used = 300
   Remainder = 25
   slider1.maximum = Remainder   + slider1.value 
            Becoming 25          + 125
   Slider2.maximum = Remainder   + slider2.value
            Becoming 25          + 50
   Slider3.maximum = Remainder   + slider3.value
            Becoming 25          + 125  

我认为这不会变得更清楚,所以请给我一些反馈。非常感谢!

一旦用户对设置感到满意,应该使用按钮将其发送回服务器..

1 个答案:

答案 0 :(得分:0)

我知道这是一个老问题,但由于没有人回答,这是我看到的第一页(谷歌搜索同一个问题),我想我会放弃我在这里找到的答案。也许它会缩短其他人的搜索。

假设您正在扩展的文本框名为Slider1。您可以使用$ find()设置滑块的值和最大值。即:

$find("Slider1").set_Maximum(100);
$find("Slider1").set_Value(500);

绑定文本框中获取滑块的值,与从任何其他元素获得的方式相同。所以:

var sliderValue = document.getElementById('<%=Slider1_bound.ClientID%>').value;
  • 皮特