Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Problem resetting slider values

$
0
0

Hi,

I have several slider values contained in an accordion panel.  I have a button, btnResetSliders, that I use to reset all the values of the sliders to zero (0).  I've tried all kinds but it just isn't working.  The button html tag is as follows:

<asp:ButtonID="btnReset"runat="server"Text="Reset Sliders"Width="150px"OnClick="btnReset_Click"/>

The sliders are inside <ul><li> tags.  See sample snippet below:

<ul>
  <li><h4>Cropland</h4></li>
    <div id="sliderDiv" >
      <asp:Label ID="CroplandSlider_BoundControl" runat="server" AssociatedControlID="CroplandSlider" />
      <asp:TextBox ID="CroplandSlider" runat="server" AutoPostBack="True" Text="0" BorderStyle="None"
          OnTextChanged="CroplandSlider_TextChanged" ClientIDMode="Static" />
      <ajaxToolkit:SliderExtender ID="CroplandSliderExtender" runat="server"
            Enabled="true"
            BehaviorID="CroplandSlider"
            TargetControlID="CroplandSlider"
            Minimum="-100"
            Maximum="100"
            BoundControlID="CroplandSlider_BoundControl"
            RailCssClass="croplandrail"
            HandleCssClass="croplandhandle"
            HandleImageUrl="~/images/sliders/cropland_handle.png"
            EnableHandleAnimation="true">
      </ajaxToolkit:SliderExtender>
    </div>
  </li>
</ul>

..and so on.  The sliders are in Default.aspx web page.  I'm using a Master page.  I placed the javascript at the bottom of the Default.aspx page, just before the </asp:Content> tag .  The javascript is as follows:

<script type="text/javascript">
  function resetValue() {
    document.getElementById("CroplandSlider").value = 0;
   ... all other sliders here....
  }
</script>

The code behind:

protected void btnReset_Click(object sender, EventArgs e)
{
  If (Page.IsPostBack)
  {
    Page.ClientScript.RegisterStartupScript(this.GetType(), "JSScript", "resetValue();", true);
  }
}

It has no effect whatsoever on the values or location of the slider handles.

Appreciate any help.


   


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>