Hi nedash,
Refer the below sample.
HTML
<div>
<asp:GridView runat="server" ID="gvConverNumericDigitToPersian" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="Tell" ItemStyle-Width="110px" ItemStyle-HorizontalAlign="Center"
ItemStyle-VerticalAlign="Middle">
<ItemTemplate>
<asp:Label ID="lblCustomerID" runat="server" Text='<%#toPersianNumber(Eval("Tell").ToString())%>'
CssClass="lblpey"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[1] { new DataColumn("Tell", typeof(int)) });
dt.Rows.Add(12345);
dt.Rows.Add(15648);
dt.Rows.Add(15478);
dt.Rows.Add(13982);
gvConverNumericDigitToPersian.DataSource = dt;
gvConverNumericDigitToPersian.DataBind();
}
}
public string toPersianNumber(string input)
{
string[] persian = new string[10] { "۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹" };
for (int j = 0; j < persian.Length; j++)
{
input = input.Replace(j.ToString(), persian[j]);
}
char[] charArray = input.ToCharArray();
Array.Reverse(charArray);
return new string(charArray);
}
Output
Tell |
۵۴۳۲۱ |
۸۴۶۵۱ |
۸۷۴۵۱ |
۲۸۹۳۱ |