Convert Textbox value to int and also check for is it Empty or Not
<p>I am trying to update record of a person in a gridview  when i am input into textbox(tAge) it shows me an exception <strong>Input string was not in a correct format.</strong> i had tried a lot of codes but won't work please help me out.And <strong>thanks</strong> in advance.
here is my code to update Person details</p>

<pre><code>protected void UpdateRecord(object sender, GridViewUpdateEventArgs e)
{
    int personID = Int32.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
    int intResult = 0;
    GridViewRow row = GridView1.Rows[e.RowIndex];
    TextBox tFN = (TextBox)row.FindControl("txtFName");
    TextBox tLN = (TextBox)row.FindControl("txtLName");
    TextBox tAge = (TextBox)row.FindControl("txtAge");
    // instantiate BAL
    PersonBAL pBAL = new PersonBAL();
    PersonBO person = new PersonBO();
    try
    {
        person.PersonID = personID;
        person.FirstName = tFN.Text;
        person.LastName = tLN.Text;
        person.Age = Int32.Parse(tAge.Text);
        //if (String.IsNullOrEmpty(String.Trim(tFN.Text)))
        if (tFN.Text.Trim() == "")
        {
            lblMessage.Text = "Name can't be Blank";
        }
        else if (tLN.Text.Trim() == "")
        {
            lblMessage.Text = "LastName can't be Blank";
        }
        else if (tAge.Text.Trim()=="")
        {
            lblMessage.Text = "Age can't be Blank";
        }
        else
        {
            intResult = pBAL.Update(person); 
        if (intResult &gt; 0 &amp;&amp; tFN.Text != "")
        {
            string message = "Updated Successfully!";
            string script = "window.onload = function(){ alert('";
            script += message;
            script += "');";
            script += "window.location = '";
            script += Request.Url.AbsoluteUri;
            script += "'; }";
            ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true);
        }
        //else if( tFN.Text == "")
        //{
        //} 
        else
        {
            string message = "Already Exist!";
            string script = "window.onload = function(){ alert('";
            script += message;
            script += "');";
            script += "window.location = '";
            script += Request.Url.AbsoluteUri;
            script += "'; }";
            ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true);
            //lblMessage.Text = message.ToString();
        }
    }
    }
    catch (Exception ee)
    { 
        lblMessage.Text = ee.Message.ToString(); 
    }

    finally
    {
        person = null;
        pBAL = null;
    }
    GridView1.EditIndex = -1;
    // Refresh the list
    BindGrid();
}
</code></pre>