You can do one of the following:
1) Use Asp.Net's range validator.
https://msdn.microsoft.com/en-us/library/f70d09xt(v=vs.71).aspx[
^]
2) Or if you are a JavaScript-UI ninja then do something like this:
<input type="text" id="txtNumber" runat="server"/>
<script>
document.addEventListener('DOMContentLoaded', function () {
var textBox = document.getElementById('txtNumber');
textBox.onchange = validateNumbeRange.bind(textbox, 6, 8);
});
function validateNumbeRange(min, max) {
var value = parseFloat(this.value);
if (isNaN(value) || !(!isNaN(value) && value >= min && value <= max))
alert('Invalid value');
}
</script>
The above is calling a function on textbox value change and then validating the value.