Salut tous le monde,
je rencontre le meme probleme actuellement et j'ai essayé de le résoudre avec toutes les solutions proposer mais toujours la meme exception est lancée " Input string was not in a correct format" voici la partie du code source
"int
id Convert.ToInt32(Request["id"].ToString());DataTable dt (DataTable) Session["panier"];
dt.Rows.RemoveAt(id);
for (
int i=0; i< dt.Rows.Count; i++){
dt.Rows[i]["index"] = i;
}
int ptttc=0;
for (
int i= 0; i<dt.Rows.Count; i++){
int ptc Convert.ToInt32(dt.Rows[i]["puttc"].ToString()) ; //le probleme est iciptttc ptttc + ptc;
}
Session["total"]=ptttc.ToString();
Session["panier"] = dt;
Response.Redirect("panier.aspx");
et l'exception est
"
<h1>Server Error in '/' Application.
<hr width="100%" color="silver" size="1" />
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.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +0
System.Int32.Parse(String s) +38
smartech.makina.deletefromcart.Button2_Click(Object sender, EventArgs e)
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
<hr width ="100%" color= "silver" size="1" /> Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
<!--
[FormatException]: Input string was not in a correct format.
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s)
at smartech.makina.deletefromcart.Button2_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain()
[HttpUnhandledException]: Exception of type System.Web.HttpUnhandledException was thrown.
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
--><!--
This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using <customErrors mode ="Off"/>. Consider using <customErrors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.-->le langage utilisé est le C#
merci d'avance pour votre Aide et j'espère que il ya une personne qui a la solution
@er
</h2>