Error message during Databind in C#/Visual Studio 2008

I am trying to databind an integer from a text box and am getting the following error:

System.FormatException was unhandled
  Message="Input string was not in a correct format."
  Source="mscorlib"

I am successfully populating a text box with a number - say 21139.

This is the line of code I am getting the error on:

mortgee.MortId = int.Parse(this.txtNextMortId.Text.ToString());

Where mortgee is a business object i have created, and MortId is a public member that is an integer.

Any Ideas.. I hope I described this ok.

I try to bind to this value with the below code:
jamesdean666Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ororioleConnect With a Mentor Commented:
Its telling you that your input string has non integer chars in it. Alphas, whatever, that it cant convert to an integer. So look at what you are passing to int.Parse.
0
 
jamesdean666Author Commented:
Thanks.
0
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.

All Courses

From novice to tech pro — start learning today.