I have one problem when I am trying to compare two string value in grid view. it will show error:operator > cant beapplied to operands of type string and string
string x = e.Row.Cells[7].Text.Trim();
string y = e.Row.Cells[8].Text.Trim();
if (x > y)
{
}
else
{
}
how to compare it ?. plz give me answer
Sanjeeb LenkaPosted Aug 22, 2013, 1:57 AM
int x = Convert.ToInt32(e.Row.Cells[7].Text.Trim());
int y = Convert.ToInt32(e.Row.Cells[8].Text.Trim());
if (x > y)
{
}
else
{
}
Iftikar HussainPosted Aug 22, 2013, 1:55 AM
You need to use String.Compare method
Regards,
Iftikar