Click here to Skip to main content
15,909,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello.
I have design a form with asp.net4 which is binded to Sqlserver 2008r2 ,
my form is made by Asp.Net formview that has to insert data into the database .

i have also included my formview inside an UpdatePanel , but when press the insert button this exception in the is generated:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in a correct format.

this exception occures in a locked dynamic page: ScriptResource.axd

but whenever i remove the UpdatePanel from my form this exception doesn't occure again , but the other Unhandled exception occures :

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.

VB
[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +9591147
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119
   System.String.System.IConvertible.ToInt32(IFormatProvider provider) +46
   System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +297
   System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +126
   System.Web.UI.WebControls.Parameter.GetValue(Object value, Boolean ignoreNullableTypeChanges) +63
   System.Web.UI.WebControls.SqlDataSourceView.AddParameters(DbCommand command, ParameterCollection reference, IDictionary parameters, IDictionary exclusionList, String oldValuesParameterFormatString) +550
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +306
   System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +89
   System.Web.UI.WebControls.FormView.HandleInsert(String commandArg, Boolean causesValidation) +377
   System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +612
   System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source, EventArgs e) +95
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source, EventArgs e) +112
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +125
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +167
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Posted

1 solution

Are you trying to convert string value to integer datatype?
string value assign to a datatype of Integer type, then you need to convert it to Integer

C#
string strNumber = "9";
int number = Convert.ToInt32(strNumber);
 
Share this answer
 
Comments
mohammad ehsan 12-Jul-12 2:09am    
actually all of my datatype's fields are not integer , exceept some of them as well as : personelCode , PostalCode , IdentiyCardNum , but all of their datatype in my database are int , and i don't know what else has to be done in form?
mohammad ehsan 12-Jul-12 2:40am    
i don't know what has to be converted to integer and where this act has to be done?

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