I have a class that I am passing a value too from my textbox. I use int? in the class I am passing too, to allow null values. Every-time I execute it gives the input string is not in correct format error. How can I get it to allow the null value? I thought about creating an if statement that just passes string = "null". I put my code below thank you in advance.
This is what I use to pass the values to my class that gives the error when I leave it blank.
newGrid.EmployeeID = Convert.ToInt32(employeeIDTextBox.Text);
newGrid.JobID = Convert.ToInt32(JobIDTextBox.Text);
Variable declaration in my class that the info is passing to.
public int? JobID { get; set; }