c# - ASP.NET NumericUpDownExtender with button hold support? -
hi trying "updown" button allows user hold increment/decrement button , increment/decrement decimal value. have been trying using ajaxtoolkit:numericupdownextender seems allow increment/decrement button clicks. rather clunky since value percentage. ideas of better way handle within asp.net?
i able make pretty javascript using timer. here aspx part of it:
<asp:textbox id="factor" runat="server" maxlength="6" width="60"/> <input id ="upbutton" value="▲" type="button" onmousedown="timerid = setinterval(function(){factup()},100);" onmouseup="clearinterval(timerid);"/> <input id ="downbutton" value="▼" type="button" onmousedown="timerid = setinterval(function(){factdown()},100);" onmouseup="clearinterval(timerid);"/>
and javascript:
var timerid = 0; function factdown() { var obj = document.getelementbyid('factor'); var num = parsefloat(obj.value) if (isnan(num)) { return; } num -=0.01; obj.value = num.tofixed(2); } function factup() { var obj = document.getelementbyid('factor'); var num = parsefloat(obj.value); if (isnan(num)) { return; } num += 0.01; obj.value = num.tofixed(2); }
Comments
Post a Comment