I am Currently using windows xp. Also using Visual Web Developer 2005 and Microsoft Sql server 2005.
The main page consists of an aspx page and a master page.
The page also consists of a label control(hidden when run in browser).
Also an Sql data source control connected to database tables for a photo album.
Also label web control ID=UserIdValue.
Also a Details View control ID=dvPictureInsert
Problem is how to work out what an “Unhandled exception “is and how to work out what
“Input string was not in a correct format” is.
When I put a category, Id and description values on my website and click on the insert hyperlink you get the “Input string was not in the correct format”.
Input string was not in a correct format. It would be appreciated if someone could explain how to read and understand the unhandled exception below.
Below is the unhandled exception
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:
Expand|Select|Wrap|Line Numbers
- [FormatException: Input string was not in a correct format.]
- System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2752899
- System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +102
- System.String.System.IConvertible.ToInt32(IFormatProvider provider) +43
- System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +293
- System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +248
- System.Web.UI.WebControls.SqlDataSourceView.AddParameters(DbCommand command, ParameterCollection reference, IDictionary parameters, IDictionary exclusionList, String oldValuesParameterFormatString) +547
- System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +304
- System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +68
- System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg, Boolean causesValidation) +394
- System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +609
- System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e) +88
- System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
- System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e) +109
- System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
- System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +85
- System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +153
- System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
- System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
- System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +170
- System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4921
- Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
- Below is the event handler source code
- Partial Class PhotoAdmin_Default
- Inherits System.Web.UI.Page
- Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
- UserIdValue.Text = Membership.GetUser().ProviderUserKey.ToString()
- End Sub
- Protected Sub dvPictureInsert_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles dvPictureInsert.ItemInserting
- e.Values("UserId") = Membership.GetUser().ProviderUserKey
- e.Values("UploadedOn") = DateTime.Now
- End Sub
- End Class