Error: No overload for method ToString takes 1 arguments for thousand separator in ASP.Net

Last Reply on Jun 12, 2017 08:53 AM By dharmendr

Posted on Jun 12, 2017 08:30 AM


I put label in page that bind number from database I want use thousand seprator for this label so I wrote below code in behind code:

LblkolP.Text = toPersianNumber(_dr["TotalPrice"].ToString("N0"));

but below error:

Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS1501: No overload for method 'ToString' takes 1 arguments Source Error:

Line 57:                     Lblejare.Text = toPersianNumber(_dr["ejare"].ToString());
Line 58:                     Lblvadie.Text = toPersianNumber(_dr["rahn"].ToString());
Line 59:                     LblkolP.Text = toPersianNumber(_dr["TotalPrice"].ToString("N0"));



Posted on Jun 12, 2017 08:53 AM

First you need to convert the value to int or decimal and then convert to ToString with argument.

LblkolP.Text = toPersianNumber(Convert.ToInt32(_dr["TotalPrice"]).ToString("N0"));