By using jQuery slider, I have customized the Css styles to give a different look. Click here to refer the jQuery API documentation.
This will allow your users to select a value from a numerical range by simply dragging a slider.
Step 01:
Add following script links to the header tags.
I will use window.open() to maximized the web page. First look at the syntax of this method.
window.open(URL,name,specs,replace). To view the parameters please click here.
when web application development, JavaScript plays a major role in client side validations, displaying values, value calculation and much more. In this article i'll provide simple example of getting a selected value and text in Asp.Net dropdown List using client side click event. Hope this will be helpful for someone. Here we go:
If the selected Value is 0, it notifies user to select a country as a simple validation. Following code snippet elaborates JavaScript function, I have used the ClientID to get the control ID. GetSelectedCountry() is the function that i'm gonna call in onclick event in button control. Note this also can be done using jQuery also.
<script type="text/javascript">
function GetSelectedCountry() {
var countryCtrl = document.getElementById('<%=drpCountryList.ClientID %>');
if (countryCtrl != 'undefined' || countryCtrl != null) {
var selectedValue = countryCtrl.options[countryCtrl.selectedIndex].value;
var SelectedText = countryCtrl[countryCtrl.selectedIndex].text;
// simple validation, if user doesn't select a country,
// this will display an alert to the user.
if (selectedValue == 0) {
alert("Please select a country to continue!");
return false;
}
var lbl = document.getElementById('<%=lblSelectedCountry.ClientID %>');
if (lbl != 'undefined' || lbl != null) {
lbl.innerHTML = "Selected Value: " + selectedValue + "<br/>" +
"Selected Text: " + SelectedText;
}
}
}
</script>
Following code snippet for the HTML markup which display the sample country list