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 144:    {
Line 145:        viewBy = !String.IsNullOrEmpty(Request.QueryString["view"]) ? Request.QueryString["view"].ToString() : viewBy;
Line 146:        tbCategory category = db.tbCategories.FirstOrDefault(s => s.catId == int.Parse(catId));
Line 147:        if (category == null)
Line 148:            return;

Source File: d:\Hosting\huongqueonline.com\www\cms\producs\u_pro_Detail.ascx.cs    Line: 146

Stack Trace:


[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +10517315
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +207
   lambda_method(ExecutionScope ) +52

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +808
   System.Delegate.DynamicInvokeImpl(Object[] args) +115
   System.Data.Linq.CommonDataServices.GetKeyFromPredicate(MetaType type, Dictionary`2 keys, Expression mex, Expression vex) +470
   System.Data.Linq.CommonDataServices.GetKeysFromPredicate(MetaType type, Dictionary`2 keys, Expression expr) +237
   System.Data.Linq.CommonDataServices.GetKeyValues(MetaType type, LambdaExpression predicate) +98
   System.Data.Linq.CommonDataServices.GetCachedObject(Expression query) +593
   System.Data.Linq.SqlClient.SqlProvider.GetCachedResult(Expression query) +38
   System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +103
   System.Data.Linq.Table`1.System.Linq.IQueryProvider.Execute(Expression expression) +46
   System.Linq.Queryable.FirstOrDefault(IQueryable`1 source, Expression`1 predicate) +422
   cms_producs_u_pro_Detail.LoadData() in d:\Hosting\huongqueonline.com\www\cms\producs\u_pro_Detail.ascx.cs:146
   cms_producs_u_pro_Detail.Page_Load(Object sender, EventArgs e) in d:\Hosting\huongqueonline.com\www\cms\producs\u_pro_Detail.ascx.cs:42
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
   System.Web.UI.Control.OnLoad(EventArgs e) +132
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428


Version Information: Microsoft .NET Framework Version:2.0.50727.8974; ASP.NET Version:2.0.50727.8974