Only Numbers Letters in Uppercase in C# TextBox


To only allow numbers and letters in uppercase while typing in a C# TextBox use the following javascript
Visual Studio 2008 3.5
add to Page_Load:
protected void Page_Load(object sender, EventArgs e)
       string script = @"
       function ToUpperNoSpecial(ctrl)
                var t = ctrl.value;
                ctrl.value = t.toUpperCase().replace(/\W/g, '');
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ToUpperNoSpecial", script, true);
add to asp of page/object:
<asp:TextBox ID="text1" onkeyup="ToUpperNoSpecial(this)" runat="server"  MaxLength="34" Width="400px"  ></asp:TextBox>