I would like to make one numeric-only textbox. I'd like to then add that same to the control toolbox within Visual Studio 2008
I've already built the function to allow only numeric.
How can I make it available in the toolbox?
I would like to make one numeric-only textbox. I'd like to then add that same to the control toolbox within Visual Studio 2008
I've already built the function to allow only numeric.
How can I make it available in the toolbox?
this is how you can create numeric textbox
public class NumericTextBox : TextBox
{
protected override void OnKeyPress(KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
{
e.Handled = true;
}
base.OnKeyPress(e);
}
}
Please Check the Link
http://msdn.microsoft.com/en-us/library/yhzc935f.aspx
This will help you to Create Custom Control and How to use the control in web form
you can inherit the WebControl Class and add your numeric only logic in your control
Don't reinvent the wheel. Download this:
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/NumericUpDown/NumericUpDown.aspx