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:


Line 20:                 //hypcat.Text = catx;
Line 21:                 //hypcat.NavigateUrl = catx;
Line 22:                 double pid = Convert.ToDouble(RouteData.Values["id"].ToString());
Line 23:                 //SDSPrd.SelectCommand = "select * from Products where pid='" + pid.ToString() + "'";
Line 24:                 var cx = db.Categories.Where(s => s.category1 == catx).Select(x => new { categorycode = x.categorycode }).Single();

Source File: d:\Inetpub\vhosts\rmechmachines.com\hmwarakhwala.in\Product-detail.aspx.cs    Line: 22

Stack Trace:


[FormatException: Input string was not in a correct format.]
   System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) +14619532
   System.Convert.ToDouble(String value) +65
   Product_detail.Page_Load(Object sender, EventArgs e) in d:\Inetpub\vhosts\rmechmachines.com\hmwarakhwala.in\Product-detail.aspx.cs:22
   System.Web.UI.Control.OnLoad(EventArgs e) +108
   System.Web.UI.Control.LoadRecursive() +90
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1533


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4700.0