Ramblings & Controls from a .NET Addicted Freak!

Kevin Gearing's Blog

New Control - CasedTextBox - Sets TextBox Character Case

Unlike Windows Forms.NET, ASP.NET textbox controls seem to be missing the 'Character Casing' property which allows you to define the case of characters entered within a textbox.

Whilst it's fairly easy to replicate by hooking up some JavaScript to the 'onblur event', e.g.

txtEMailAddress.Attributes.Add("onblur", "this.value = this.value.toLowerCase();");

it becomes a bit of a pain having to enter this on every page. So, below is a simple ASP.NET control that basically does it for you. It simply inherits from the standard TextBox class and adds a new 'Character Casing' property allowing you to set the character case to one of three options:


  • CharacterCasing property to set the case to upper (all characters uppercase), upper first (only the first character uppercase) or lower (all characters lowercase).
  • Full Visual Studio .NET designer integration.


Simply download, add to your toolbox, drag 'n' drop to your page and set the property using the property grid.

Licensing & Download:

Free for both personal and commercial use, however please consider donating!

You may also redistribute the control royalty free, providing that you don't charge for it. Also, if you intend to distribute the control as part of an application which is publicly available it would be nice to know, although this isn't a requirement.

To download, please visit the 'Downloads' area.


Help & Support:

Please post in the forum.


Revision History:

Updated 05/06/2007 (v2.0.0):

Click here for details.

Updated 29/10/2004 (v1.0.0):

  • Namespace changed from dotNetFreak.WebControls.UI to dotNetFreak.WebControls.
  • Much improved designer integration.
  • Property values are now stored in ViewState.
  • OnPreRender bug fixed.
  • Assembly is now signed with a Strong Name.
Published Jul 04 2004, 03:05 PM by dotNetFreak
Filed under: ,



Jason said:

I cant seem to get this one working w/ ..

I tried
<dnf:casedtextbox id="txtName" runat="server"
charactercasing="UpperFirst" />

Didnt work, (I even imported the namespace)

Let me know how i can get it workin that'd be good.
-0 :)
Err: Unknown server tag 'dnf:casedtextbox'.
October 28, 2004 8:22 PM

Kevin Gearing said:

Hi Jason,

If you first add a reference to the dotNetFreak.WebControls.UI.CasedTextBox assembly in Visual Studio (or WebMatrix) and then add:

<%@ Register TagPrefix="dnf" Namespace="dotNetFreak.WebControls.UI" Assembly="dotNetFreak.WebControls.UI.CasedTextBox" %>

to the top of your Web form and then add:

<dnf:casedtextbox id="txtName" runat="server" charactercasing="'UpperFirst"></dnf:casedtextbox>

to the page you should be set.

I will be uploading a new version in a couple of hours with another control, so feel free to grab that one.

If you have any problems, feel free to drop me a line.
October 29, 2004 6:12 PM

Kevin Gearing said:

Note: If you're using the version uploaded yesterday, the namespace has changed from dotNetFreak.WebControls.UI.CasedTextBox to dotNetFreak.WebControls.CasedTextBox. You'll need to update any existing pages etc.
October 30, 2004 5:29 PM

Jason said:

Source File: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\member_free\98f2b1e5\5d1ff33\hk4op8x2.0.vb Line: 16

Show Detailed Compiler Output:

c:\windows\system32\inetsrv> "c:\windows\\framework\v1.1.4322\vbc.exe" /t:library /utf8output /R:"c:\windows\assembly\gac\system.web.ui.mobilecontrols.adapters\\system.web.ui.mobilecontrols.adapters.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\ffuiw3-8.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\5b8f4709\806fac63_58c3c401\votations.nsurvey.dal.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\468123c3\806fac63_58c3c401\" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\e7feafc8\806fac63_58c3c401\aspnetforums.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\e49378dc\806fac63_58c3c401\votations.netpolls.webadmin.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\c9f5411d\806fac63_58c3c401\votations.nsurvey.emailing.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\6d04daf5\00d91363_58c3c401\netpolls.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\5c956fc0\00064564_58c3c401\webchart.dll" /R:"c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\a99ee29c\806fac63_58c3c401\aspnetforums.controls.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\bce03d9e\00064564_58c3c401\votations.nsurvey.webadmin.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\335a67ab\00064564_58c3c401\popforums.ui.feature.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\af894e93\00d91363_58c3c401\freetextbox.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\502ab724\806fac63_58c3c401\votations.nsurvey.webcontrols.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\216510ff\39a45dc5_46c9c401\dotnetfreak.webcontrols.casedtextbox.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\56d38563\806fac63_58c3c401\aspnetforums.sqldataprovider.dll" /R:"c:\windows\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\5aec556c\00d91363_58c3c401\popforums.dll" /R:"c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll" /R:"c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\bf7fda46\806fac63_58c3c401\aspnetforums.components.dll" /R:"c:\windows\assembly\gac\\1.0.5000.0__b03f5f7f11d50a3a\" /R:"c:\windows\assembly\gac\\1.0.5000.0__b77a5c561934e089\" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\e36d27b5\806fac63_58c3c401\votations.nsurvey.sqlserverdal.dll" /R:"c:\windows\assembly\gac\microsoft.web.ui.webcontrols\\microsoft.web.ui.webcontrols.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\e330ff87\806fac63_58c3c401\votations.nsurvey.bll.dll" /R:"c:\windows\assembly\gac\\1.0.5000.0__b03f5f7f11d50a3a\" /R:"c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll" /R:"c:\windows\\framework\v1.1.4322\temporary files\member_free\98f2b1e5\5d1ff33\assembly\dl2\8771624c\806fac63_58c3c401\metabuilders.webcontrols.masterpages.dll" /out:"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\member_free\98f2b1e5\5d1ff33\hk4op8x2.dll" /D:DEBUG=1 /debug+ /win32resource:"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\member_free\98f2b1e5\5d1ff33\hk4op8x2.res" "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\member_free\98f2b1e5\5d1ff33\hk4op8x2.0.vb"

Microsoft (R) Visual Basic .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322.2032
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\member_free\98f2b1e5\5d1ff33\hk4op8x2.0.vb(16) : error BC30466: Namespace or type 'UI' for the Imports 'dotNetFreak.WebControls.UI' cannot be found.

Imports dotNetFreak.WebControls.UI

I used the most recent available version... I have:

<%@ Register TagPrefix="dnf" Namespace="dotNetFreak.WebControls" Assembly="dotNetFreak.WebControls.CasedTextBox" %> (at top)

and for the form fields.

<dnf:casedtextbox id="txtFirst" runat="server" columns="10" charactercasing="UpperFirst" />

November 13, 2004 6:18 AM

Jason said:

Sorry I had duplicate @ directive at top. I removed it,
and all is well. Thanks for a great control ;-) for some of us lazier programmers ;-) Isnt ASP.NET great!?

November 13, 2004 6:23 AM

David said:

Hey, this is handy - I use it to capitalise the first letter of addresses in a form I'm working on - what would make it perfect would be a casing option to capitalise the first character of each word, rather than just the first letter of the contents of the box, so that "my house" would be "My House" rather than "My house" as it is at present.

Still a great control though! :-D

January 20, 2006 11:04 AM

Kevin Gearing said:


As soon as I have time I'm planning to add exactly that!

February 8, 2006 11:04 AM

Raghava Rao said:

I am new to downloding ur cased text box how can i use it in my project.give me details how to use control.
February 16, 2006 7:23 AM

rao said:

how can i use the casedtestbox control in a project.
February 16, 2006 7:25 AM

Kevin Gearing said:

David, your suggestion has now been implimented (only took me 16 months :-)).

Raghava & Rao please see the demo included in the archive.

June 7, 2007 3:56 PM

shailesh said:

Hi Kevin Gearing,

i want to add this control in "WebUserControl.ascx".can you please help me,how we can use it?

Thanks in advance

December 24, 2007 1:55 PM

Kevin Gearing's Blog said:

CasedTextBox has been updated. Click here for details .

February 17, 2009 5:01 PM

CasedTextBox for .NET 2.0 Released - Kevin Gearing's Blog said:

Pingback from  CasedTextBox for .NET 2.0 Released - Kevin Gearing&#39;s Blog

February 17, 2009 5:03 PM

Leave a Comment


Protected by FormShield
Please enter the characters shown on the image


Copyright ©2004-2007 Kevin Gearing. All Rights Reserved.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems