<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TitleCaseDemo.aspx.cs" Inherits="TitleCaseDemo" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title>TitleCase Using JavaScript</title> <script type="text/javascript" language="javascript"> function TitleCase(objField) { var objValues = objField.value.split(" "); var outText = ""; for (var i = 0; i < objValues.length; i++) { outText = outText + objValues[i].substr(0, 1).toUpperCase() + objValues[i].substr(1).toLowerCase() + ((i < objValues.length - 1) ? " " : ""); } return outText; } </script></head><body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" onblur="this.value=TitleCase(this);" runat="server" /> <asp:TextBox ID="TextBox2" runat="server" /> </div> </form></body></html>