Click here to Skip to main content
15,892,839 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
MSIL
Server Error in '/HINDITEST' Application.
Format specifier was invalid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Format specifier was invalid.
Source Error:
Line 59:         txtLangName.Text = ddlLanguage.SelectedItem.Text;
Line 60:         txtLongDate.Text = DateTime.Now.ToLongDateString();
Line 61:         txtCurrency.Text = dblCurrency.ToString("s");
Line 62:         txtAmount.Text = dblAmount.ToString("c");
Line 63:     }

Source File: e:\HINDITEST\Default.aspx.cs    Line: 61
Stack Trace:
[FormatException: Format specifier was invalid.]
   System.Number.FormatDouble(Double value, String format, NumberFormatInfo info) +0
   System.Double.ToString(String format) +26
   _Default.ApplyLocalization() in e:\HINDITEST\Default.aspx.cs:61
   _Default.ddlLanguage_SelectedIndexChanged(Object sender, EventArgs e) in e:\HINDITEST\Default.aspx.cs:48
   System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +105
   System.Web.UI.WebControls.DropDownList.RaisePostDataChangedEvent() +134
   System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +7
   System.Web.UI.Page.RaiseChangedEvents() +117
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1646

Posted

1 solution

Vivek Kharb wrote:
txtCurrency.Text = dblCurrency.ToString("s");

's' is not a standard numeric formatter.

Look here:
http://msdn.microsoft.com/en-us/library/dwhawy9k(VS.71).aspx[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900