Grid Error

Aug 28 2015 6:36 AM
protected void btnSelect_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.Add("ItemRowId", typeof(int));
dt.Columns.Add("ItemCode", typeof(string));
dt.Columns.Add("ItemName", typeof(string));
dt.Columns.Add("MRP", typeof(float));
dt.Columns.Add("tur", typeof(float));
dt.Columns.Add("UPC", typeof(float));
foreach (GridViewRow row in xdata.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
CheckBox chkSelect = (row.Cells[0].FindControl("chkSelect") as CheckBox);
if (chkSelect.Checked)
{
int ItemRowId = int.Parse(row.Cells[1].Text);
string ItemCode = row.Cells[2].Text;
string ItemName = row.Cells[3].Text;
float MRP = float.Parse(row.Cells[4].Text);
float tur = float.Parse(row.Cells[5].Text);
float UPC = float.Parse(row.Cells[6].Text);
dt.Rows.Add(ItemRowId, ItemCode, ItemName, MRP, tur, UPC);
}
}
}
Session.Add("dtgetselectedRecords", dt);
Server.Transfer("~/Grid2.aspx");
}
showing error input string was not correct format for null values

Answers (2)