Trying to mask a passport number in a textbox C#

parksthistle

New Member
So I have a textbox that holds the value of passport # but I need to mask out 6 of the 9 numbers with X or *.I dont want to save the new passport number with the masked numbers I just want to view it but not sure if that is possible with how they set up the code before hand.\[code\]<asp:TextBox ID="txtPassportNumber" runat="server" MaxLength="9" Text="<%# ((TSAPassenger) Container.DataItem).Passport.DocumentNumber %>" Enabled="<%# IsOutsideTenDayCutoff %>" />\[/code\]Code behind (button save event):\[code\]// PassportTextBox tmpPassportNumber = item.FindControl("txtPassportNumber") as TextBox;string encodedPassport = "XXXXXX" + tmpPassportNumber.Text.Remove(0, 6);tmpPax.Passport.DocumentNumber = (tmpPassportNumber != null) ? tmpPassportNumber.Text : string.Empty;\[/code\]I added the encodedPassport part but it will then save that to the DB if I use it. Any suggestions?
 
Back
Top