| | |
Capital First letter
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Aug 2009
Posts: 17
Reputation:
Solved Threads: 0
Currently I have two textboxes & one button, Suppose In One textbox1 i write sandeep gupta after clicking on button in textbox2 Sandeep Gupta is dere using the foll. code-
I want that Text in textbox1 changes to Sandeep Gupta when i press tab to move to next field. I dont know which event to use, can u tell me!!!
ASP.NET Syntax (Toggle Plain Text)
protected void Button1_Click(object sender, EventArgs e) { string capitalized = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(TextBox1 .Text); TextInfo UsaTextInfo = new CultureInfo("en-US", false).TextInfo; TextBox2 .Text = UsaTextInfo.ToTitleCase(txtName .Text ); }
I want that Text in textbox1 changes to Sandeep Gupta when i press tab to move to next field. I dont know which event to use, can u tell me!!!
•
•
Join Date: Sep 2007
Posts: 66
Reputation:
Solved Threads: 12
•
•
•
•
Currently I have two textboxes & one button, Suppose In One textbox1 i write sandeep gupta after clicking on button in textbox2 Sandeep Gupta is dere using the foll. code-
ASP.NET Syntax (Toggle Plain Text)
protected void Button1_Click(object sender, EventArgs e) { string capitalized = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(TextBox1 .Text); TextInfo UsaTextInfo = new CultureInfo("en-US", false).TextInfo; TextBox2 .Text = UsaTextInfo.ToTitleCase(txtName .Text ); }
I want that Text in textbox1 changes to Sandeep Gupta when i press tab to move to next field. I dont know which event to use, can u tell me!!!
1) set Autopostback Property = true of Textbox1
2)
ASP.NET Syntax (Toggle Plain Text)
protected Sub Textbox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtNewJobRankSerial.TextChanged 'USE YOUR CODE. TextBox2 .Text = UsaTextInfo.ToTitleCase(txtName .Text ); End Sub
Mark as solved if it hepls you!!!
Last edited by reach_yousuf; Sep 26th, 2009 at 4:46 am.
•
•
Join Date: Jun 2009
Posts: 433
Reputation:
Solved Threads: 82
Try this code. It will convert the text into TitleCase using JavaScript.
ASP.NET Syntax (Toggle Plain Text)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DemoPage21.aspx.cs" Inherits="DemoPage21" %> <!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 runat="server"> <title></title> <script type="text/javascript" language="javascript"> function Trim(strIn) { strOut = strIn; strOut = strOut.replace(/^ */g, ""); strOut = strOut.replace(/ *$/g, ""); return strOut; } function TitleCase(oField) { var myValue = oField.value var htext = Trim(myValue); htext = htext.toLowerCase(); htext = htext.substr(0, 1).toUpperCase() + htext.substring(1, htext.length); for (var i = 1; i < htext.length; i++) { if (htext.substr(i, 1) == " ") { while (htext.substr(i, 1) == " ") i++; if (i + 1 < htext.length) htext = htext.substr(0, i) + htext.substr(i, 1).toUpperCase() + htext.substring(i + 1, htext.length); else htext = htext.substr(0, i) + htext.substr(i, 1).toUpperCase(); } } return htext; } </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>
![]() |
Similar Threads
- Error of Letter Frequencies in a Text File (C++)
- Printing words that begin within capital letters (Python)
- Website Login (ASP.NET)
- capital letter (C++)
- Capitalizing first letter of word in an array? (C)
- Need help with Quiz code (Java)
- keybord problems (OS X)
Other Threads in the ASP.NET Forum
- Previous Thread: Trouble with ConnectionString - What is my User ID and password
- Next Thread: asp.net Label is an ambiguous reference
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox class click commonfunctions compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock deployment development dgv dropdownlist dropdownmenu dynamic edit embeddingactivexcontrol expose findcontrol flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery list login menu microsoft mono mssql multistepregistration nameisnotdeclared numerical objects order panelmasterpagebuttoncontrols problem ratings rotatepage save schoolproject search security serializesmo.table silverlight smartcard sql sqlserver2005 ssl suse textbox tracking unauthorized validation vb.net video virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment webservice wizard xml youareanotmemberofthedebuggerusers





