Input string was not in a correct format.


I'm having an error on my 2.0 application. (please refer to the Server Error details at bottom)
On my website "". When user clicks on tabs below the main image, like New, User, Trucks, Specials. It some times works fine and some times raise following error. These tabs are Anthem:LinkButons which binds specific data on click and update the Anthem:Panel containing that data control.

I've tried to debug and find the problem line in my code but could not get that because as soon the user clicks on a tab it immidiatly goes to this error details page with out even executing the Page_Load event handler.

Any help will be appriciated.


Server Error in '/' Application.

Input string was not in a correct format.
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: Input string was not in a correct format.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:

[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2753299
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +102
   System.Int32.Parse(String s, IFormatProvider provider) +22
   System.Web.UI.WebControls.ImageButton.LoadPostData(String postDataKey, NameValueCollection postCollection) +192
   System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +36
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +895
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2547

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
Who is Participating?
deepu chandranConnect With a Mentor Commented:
Do the following thing first,
1) Check all your string variables in the code, this exception comes when your string formats are wrong
2) have all your code with in try..catch.. throw block
3) Log the exception into a log file or use Exception handling application block(Enterprise library) to log all exceptions
4)Publish your website and host it for production.

Can you post some of your code snippets?

It works fine, I dont find any err in that..
ROMA CHAUHANProject LeadCommented:
Yes i m also not getting any error.
You can do one thing , you can use .ToString() function wherever is needed for variables. And make sure you are passing string value in string variable parameters and int to int parameters.

If you know the code line from where u r getting this error and the webservice is on your local machine then you can keep the debug point and debug your code as well.
All Courses

From novice to tech pro — start learning today.