Question: I have a data-bound label inside a template field of a griview that displays Social Security Numbers. It currently shows the SSN's as such, 123-45-6789. I need to hide the first 5 digits so it show's like ###-##-6789. Does anyone have an example of how I might accomplish this. 

Here is the mark-up for the template fied:

```
    <asp:TemplateField HeaderText="Social Security Number" SortExpression="SSN">
         <ItemTemplate>
              <asp:Label ID="lblSSN" runat="server" Text='<%# Bind("SSN") %>'></asp:Label>
         </ItemTemplate>
    </asp:TemplateField>

```

Code block that adds decrypted SSN to grid:

```
    table.Columns.Add("SSN");
            foreach (DataRow row in table.Rows)
            {
                row["SSN"] = DecryptSSN(row["EncryptedSSN"].ToString());                   
                row.AcceptChanges();
            }

```

I'm new to programming so any help would be greatly appreciated.

Answer: 
Here is a helper method.

```
public static string GetMaskedNumber(string number)
{
    if (String.IsNullOrEmpty(number))
        return string.Empty;

    if (number.Length <= 5)
        return number;

    string last5 = number.Substring(number.Length - 5, 5);
    var maskedChars = new StringBuilder();
    for (int i = 0; i < number.Length - 5; i++)
    {
        maskedChars.Append(number[i] == '-' ? "-" : "#");
    }
    return maskedChars + last5;
}

```

Result
------

123-123-1234 to ###-##-1234
how bout this? 

```
  select '###-##-'+right(ssn_coumn,4) as ssn  from your_table 

```