hi,
i need to create a numeric textbox control which accepts only numbers,
decimal point, backspace, arrow keys, should not allow pasting contents...
etc.
i've created a web user control by extending TextBox class and added a
javascript attribute to it as base.attributes.add("onkeydown","some
javascript code");
Its working when im giving the javascript code here, its not working when im
giving javascript code in its html section...
As there may be lots of lines in the javascript code, it should be placed
somewhere and the function only should be called from attributes.add()
method...
Please provide help.
Gaurav Vaish (www.EduJini.IN) - 21 Aug 2006 15:57 GMT
> Its working when im giving the javascript code here, its not working when
> im
> giving javascript code in its html section...
Probably the fault in Javascript code.
> As there may be lots of lines in the javascript code, it should be placed
> somewhere and the function only should be called from attributes.add()
> method...
How are you calling the other method from onchange (client-side)?
Is there any Javascript error?
The final HTML generated may look like:
<input type='text' name='numberbox' id='numberbox' onchange='return
checkData(this)' />
<script language='javascript' type='text/javascript'>
function checkData(ctrl)
{
var value = ctrl.value;
// Validate the value here... and return the validation result.
}
</script>

Signature
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.org
http://www.edujini.in | http://webservices.edujini.in
-------------------