You must Sign In to post a response.
  • Category: ASP.NET

    Get row number and column number for linq foreach

    I require a row number and column number to be fetched whenever error happens on certain row inside foreach.

    [B]My code goes like this:[/B]

    DataTable.AsEnumerable()
    .Where(r => r.Field<string>(columnName).Length == 0).ToList()
    .ForEach(p => p.SetField<string>(columnName, " "));

    [B]My QUESTION :[/B] How to get row number and column number using this LINQ query
  • #766318
    Hi
    try this code



    try
    {
    List<string> lststr = new List<string>();
    lststr.Add("A");
    lststr.Add("B");
    lststr.Add("C");
    lststr.Add("D");
    lststr.Add("E");
    lststr.Add("F");
    lststr.Add("G");
    lststr.Add("H");

    for (int i = 0; i <= lststr.Count - 1; i++)
    {
    if (i == 5)
    {
    //Statement
    }
    }
    }
    catch (Exception ex)
    {
    Response.Write(ex.Message);

    }


    }


    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


Sign In to post your comments