Error message
Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
Line 316: Line 317: Line 318: for (int i = 0; i < Convert.ToInt32(txtNo.Text); i++) Line 319: { Line 320: AddNewData();
My code
protected void Add(object sender, EventArgs e)
{
Label50.Text = IsDoubleNaN(txtNo.Text);
TextBox3.Visible= false;
TextBox4.Visible = false;
DropDownList2.Visible = false;
Button2.Visible = false;
Label72.Visible = false;
Label73.Visible = false;
Label74.Visible = false;
for (int i = 0; i < Convert.ToInt32(txtNo.Text); i++)
{
AddNewData();
}
BindGridview();
MainView.ActiveViewIndex = 1;
}
public string IsDoubleNaN(string text)
{
if (string.IsNullOrEmpty(text))
{
return "it's not a number";
}
Double num = 0;
bool isDouble = Double.TryParse(text, out num);
return isDouble ? "it's a number" : "it's not a number";
}