I have as ASP.NET application, it uses Bootstrap sliders, but the customer wants changes to the slider and changing the Bootstrap slider appears a nightmare, he has provided me with a sample jQuery slider that does what he wants BUT swapping the 2 sliders presents me with a server side problem - how do I initialise the jQuery slider with a database value, and on submit how do I read back any new value. Below is the server side C# code that works for Bootstrap's slider, but it uses an input HTML element The id of this is
SPCSlider, so to write I call the
writeBootstrapSlider as follows
writeBootstrapSlider(SPCSlider, OptionFlds["SPCGrade"].ToString());
void writeBootstrapSlider(HtmlInputText theBox, string theValue)
{
/* Set up a Boostrap slider value that is stored as an Attribute */
if (string.IsNullOrEmpty(theValue))
theValue = "0";
theBox.Attributes.Add("data-slider-value", theValue);
}
I read it back by simply taking the value of the base input field.
SPCSlider.Value
But the jQuery slider uses a div and I can't find anything that tells me how, from my server side C# I can
a) initialise the value
b) read it back when the form is submitted.
I have a possible work around but given that a slider is on the client and an input field, I am sure that there must be an 'accepted' mechanism for accessing values via C# that would be an improvement on my idea, but I can't seem to find any. (My fall back mechanism for writing/reading back is hidden fields but we have a LOT of sliders so I'd like to see if there is an accepted ideal mechanism that precludes hidden fields before I go ahead.)