chiranjeevi mugibari

chiranjeevi mugibari

  • 1.4k
  • 215
  • 7.9k

Display GridError

Aug 28 2015 7:09 AM
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);
}
}
}
Session.Add("dtgetselectedRecords", dt);
Server.Transfer("~/Grid2.aspx");
 
It is in float format and it accepts null values.  
showing error :  input string was not in correct format 

Answers (2)