We help IT Professionals succeed at work.
Get Started

NoUISlider retrieving and populating values from code behind

Starr Duskk
Starr Duskk asked
Last Modified: 2019-12-12
I am using a NoUISlider in asp.net and want to know how to retrieve the values for the slider. It is a multi-slider, so needs to return the left and right sides.
From what I've determined by reading, I will attach a javascript method to the save button.
btnSave.Attributes.Add("onClick", "SaveSlider();return true;")

Open in new window

Then the javascript will store the values to two hidden elements and I'll use those server side.

Code would look something like this:

    function SaveSlider() {

        var slider = document.getElementById('slider-tooltips');
        var values = slider.noUiSlider.get();

      //  var values = $('#exampleSlider0').noUiSlider('value');

        document.getElementById("hdnSlider1").value = values(0);
        document.getElementById("hdnSlider2").value = values(1);

Open in new window

I read that it retrieves the values as an array.

How do I retrieve and store the values to the hidden fields?

Also, any suggestions for populating the values on page load with existing values?

Anyone have an existing method?

Watch Question
Distinguished Expert 2020
This problem has been solved!
Unlock 3 Answers and 6 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE