I have the below code:
var ConLeads = repo.Find(Int32.Parse(Request.QueryString["id"]));
***var Customer = Custrepo.Find(Int32.Parse(ConLeads.ClientName));***
IDTextBox.Text = ConLeads.ID;
CreatedByTextBox.Text = ConLeads.CreatedBy;
***ExisitingClientTextBox.Text = Customer.Client_Name;***
NewClientTextBox.Text = ConLeads.PotentialClientName;
ContactNameTextBox.Text = ConLeads.ContactName;
IssueDateTextBox.Text = ConLeads.IssueDate;
DetailsTextBox.Text = ConLeads.Details;
ClientTelNoTextBox.Text = ConLeads.ClientTelNo;
ClientIDTextBox.Text = ConLeads.ClientName;
I receive the below error message when running my code on the lines above in Bold and Italic:
Input string was not in a correct format Error
The reason the error occurs is due to the cell in the database being blank. This is correct as not all entries will have a value as the ExisitingClientTextBox is not a mandatory filed that required an entry into the database. Is there a way to stop this error occurring when the Database value is blank?