c# is not accepting var datatype C# is not recognizing var "datatype"
if (e.Row.RowType == DataControlRowType.DataRow)
{
    var  lblNewsal = e.Row.FindControl("lblSalary") as Label;
    if (lblNewsal != null)
    {
Total += int.Parse(lblNewsal.Text);
    }
}

Error is:

Error 1 The type or namespace name 'var' could not be found (are you
  missing a using directive or an assembly reference?)
  G:\ControlsExample\GridViewDemo\Default.aspx.cs 31 14
  G:\ControlsExa‌​mple\GridViewDemo\


The var keyword was introduced to C# 3.0 (Visual Studio 2008+), so cannot be used for .NET 2.0 and before (so anything before Visual Studio 2005 will not have support for it).
You need to either use the explicit type in that line:
Label lblNewsal = e.Row.FindControl("lblSalary") as Label;

Or upgrade.

You need to upgrade C# version,or just use Label rather than var