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>

Open in new window

LVL 1
Michael SterlingWeb Applications DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MlandaTCommented:
when you get that error do you have a line number? is the error not happening in your codebehind file?
0
MlandaTCommented:
try to capture the complete stacktrace of the error.that should give a good indication where the issue is happening.
0
Michael SterlingWeb Applications DeveloperAuthor Commented:
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

Open in new window

0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

MlandaTCommented:
does ddlSportEdit have any entries that are not numeric? maybe a blank item to denote no selection?
0
Michael SterlingWeb Applications DeveloperAuthor Commented:
yes it does...
0
MlandaTCommented:
does this error only come up when you have not selected a value? perhaps give that blank item a value of 0 or something.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alfred A.Commented:
This error occurs when you try to convert a non-numeric or empty string into an integer.  

You could try setting a default value to your control parameter.  See the modified code below.  However, if there is a way for you to have only numeric integer values in your dropdownlist, this would solve your problem.


<WhereParameters>
       <asp:ControlParameter ControlID="ddlSportEdit" Name="SportUid" DefaultValue="0" 
           PropertyName="DataValueField" DbType="Int32" />
</WhereParameters>

Open in new window

0
Michael SterlingWeb Applications DeveloperAuthor Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.