Add file to App_Code/Common/AadhaarMasking.cs
using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for AadhaarMasking
/// </summary>
public class AadhaarMasking
{
public AadhaarMasking()
{
//
// TODO: Add constructor logic here
//
}
public string AadhaarNoMasking(string AadhaarNo)
{
string MaskAadhaarNo = "";
if (AadhaarNo.Length > 4)
{
MaskAadhaarNo = AadhaarNo.Substring(AadhaarNo.Length - 4).PadLeft(AadhaarNo.Length, 'X');
}
return MaskAadhaarNo;
}
}
---------------------------------
aspx page code
<asp:Label ID="lbl_AdhaarMask" runat="server" Text='<%#new AadhaarMasking().AadhaarNoMasking(Eval("Adharcard_No").ToString()) %>'></asp:Label>
No comments:
Post a Comment