I have a web form that has a print button on it. The print button prints out four different reports depending on the value of the three textboxes.
Here is the Print button code:
if (Page.IsValid)
{
int iTextBoxFTE40 = Convert.ToInt32(TextBoxFTE40.Text);
int iTextBoxHC50 = Convert.ToInt32(TextBoxHC50.Text);
int iTextBoxFTE4050 = Convert.ToInt32(TextBoxFTE4050);
if (iTextBoxFTE40 > 40)
{
TextBoxINST_ID.Text = Session["inst_id"].ToString();
ClientScript.RegisterStartupScript(this.GetType(), "onclick", "<script language=javascript>window.open('ReportFormFTE40.aspx','PrintMe','height=650px,width=950px,scrollbars=1');</script>");
ScriptManager.RegisterStartupScript(this, typeof(Page), "myscript", "alert('You have successfully submitted the electronic portion of the General and Enrollment Profile. Please send your signed Profile along with any required attachments to SACSCOC, Attn: Profiles, 1866 Southern Lane, Decatur, Ga 30033.');location.href='WelcomeMenu.aspx';", true);
}
else if (iTextBoxHC50 > 50)
{
TextBoxINST_ID.Text = Session["inst_id"].ToString();
ClientScript.RegisterStartupScript(this.GetType(), "onclick", "<script language=javascript>window.open('ReportFormFTE50.aspx','PrintMe','height=650px,width=950px,scrollbars=1');</script>");
ScriptManager.RegisterStartupScript(this, typeof(Page), "myscript", "alert('You have successfully submitted the electronic portion of the General and Enrollment Profile. Please send your signed Profile along with any required attachments to SACSCOC, Attn: Profiles, 1866 Southern Lane, Decatur, Ga 30033.');location.href='WelcomeMenu.aspx';", true);
}
else if (iTextBoxFTE4050 > 90)
{
TextBoxINST_ID.Text = Session["inst_id"].ToString();
ClientScript.RegisterStartupScript(this.GetType(), "onclick", "<script language=javascript>window.open('ReportFormFTE4050.aspx','PrintMe','height=650px,width=950px,scrollbars=1');</script>");
ScriptManager.RegisterStartupScript(this, typeof(Page), "myscript", "alert('You have successfully submitted the electronic portion of the General and Enrollment Profile. Please send your signed Profile along with any required attachments to SACSCOC, Attn: Profiles, 1866 Southern Lane, Decatur, Ga 30033.');location.href='WelcomeMenu.aspx';", true);
}
else
{
TextBoxINST_ID.Text = Session["inst_id"].ToString();
ClientScript.RegisterStartupScript(this.GetType(), "onclick", "<script language=javascript>window.open('ReportFormFTE.aspx','PrintMe','height=650px,width=950px,scrollbars=1');</script>");
ScriptManager.RegisterStartupScript(this, typeof(Page), "myscript", "alert('You have successfully submitted the electronic portion of the General and Enrollment Profile. Please send your signed Profile along with any required attachments to SACSCOC, Attn: Profiles, 1866 Southern Lane, Decatur, Ga 30033.');location.href='WelcomeMenu.aspx';", true);
}
When the Print button is clicked this error comes up:
Unable to cast object of type 'System.Web.UI.WebControls.TextBox' to type 'System.IConvertible'.
What does this mean? It happens on this line:
int iTextBoxFTE4050 = Convert.ToInt32(TextBoxFTE4050);
How can I fix this?