Here is sample code for TextBox Validation to allow Numbers only.
[code:c#]
<script type = "text/javascript" language = "javascript">
function CheckTextBox(i)
{
if(i.value.length>0)
{
i.value = i.value.replace(/[^\d]+/g, '');
}
}
</Script>
[/code]
In Code behind add this function to "onkeyup" event for TextBox
[code:c#]
TextBox1.Attributes.Add("onkeypress", "CheckTextBox(this)");
[/code]