Michael Sterling
asked on
Input string was not in a correct format?
as the title suggests, i'm getting an: "Input string was not in a correct format.? exception / error on my page when it loads and i'm not sure why. I don't quite understand what the "Name" value (in layman's terms) refers to in the properties of the ControlParameter, which i'm sure is part of the problem. are there any good code examples that I can follow? I've attached my segment of code.
<li>
<asp:Label ID="Label9" runat="server" AssociatedControlID="ddlSportEdit" Text="Team:" />
<asp:DropDownList CssClass="ddl-AthAddEdit" ID="ddlSportEdit" runat="server" DataSourceID="dsSportEdit"
DataValueField="utSportTeamUid" DataTextField="SportTeamName" AutoPostBack="true"
>
</asp:DropDownList>
<asp:EntityDataSource ID="dsSportEdit" runat="server" ConnectionString="name=SttEdmxEntities"
DefaultContainerName="SttEdmxEntities" EnableFlattening="False" EntitySetName="utsportteams"
AutoGenerateWhereClause="true">
<WhereParameters>
<asp:ControlParameter ControlID="ddlSportEdit" Name="SportUid"
PropertyName="DataValueField" DbType="Int32" />
</WhereParameters>
</asp:EntityDataSource>
<asp:Button ID="btnAddSport" Text="+ Add New" CssClass="dl-add-button ui-corner-all"
runat="server" OnClick="btnAddSport_Click" CausesValidation="false" />
</li>
when you get that error do you have a line number? is the error not happening in your codebehind file?
try to capture the complete stacktrace of the error.that should give a good indication where the issue is happening.
ASKER
i included the stack trace...i don't think i saw a number. it's happening in the HTML though, because i have no code behind right now...
Server Error in '/StudyTimeTracker' 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:
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.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +738
System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +97
System.Web.UI.WebControls.ListControl.PerformSelect() +34
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
System.Web.UI.Control.DataBindChildren() +201
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
System.Web.UI.Control.DataBind() +15
System.Web.UI.Control.DataBindChildren() +201
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
System.Web.UI.Control.DataBind() +15
System.Web.UI.Control.DataBindChildren() +201
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
System.Web.UI.Control.DataBind() +15
System.Web.UI.Control.DataBindChildren() +201
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
System.Web.UI.WebControls.FormView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +1735
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +66
System.Web.UI.WebControls.FormView.PerformDataBinding(IEnumerable data) +12
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +128
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
System.Web.UI.WebControls.FormView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
System.Web.UI.WebControls.FormView.EnsureDataBound() +183
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
System.Web.UI.Control.EnsureChildControls() +102
System.Web.UI.Control.PreRenderRecursiveInternal() +42
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.208
does ddlSportEdit have any entries that are not numeric? maybe a blank item to denote no selection?
ASKER
yes it does...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks