Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Input string is not in correct format.

C#
if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (Convert.ToInt32(e.Row.Cells[2].Text) < 300)
            {
             e.Row.Cells[2].BackColor = System.Drawing.Color.Red;
            }
         }
Posted
Comments
Shubham Choudhary 19-Mar-13 4:09am    
In which line you getting error
BeastMode10 19-Mar-13 12:13pm    
int Quantity;

if (e.Row.RowType == DataControlRowType.DataRow)
{
Quantity = Convert.ToInt32(e.Row.Cells[1].ToString());
if (Quantity < 300)
{
e.Row.BackColor = System.Drawing.Color.Red;
}
}

"Quantity = Convert.ToInt32(e.Row.Cells[1].ToString());" in this line. I tried so many codes which i found in the net. And its still getting the same error

1 solution

Solution - make sure the string is in the correct format.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900