asp.netwinformstelerikradlistview

How to get the sum of an particular column of telerik ListView?


hi can anyone help me with this i want to convert this webform code to used with telerik control,

{
    int i = 0;
    int j = 0;
    int k = 0;
    i = 0;
    j = 0;
    k = 0;

    try
    {
        j = ListView1.Items.Count;
        for (i = 0; i <= j - 1; i++)
        {
            k = k + Convert.ToInt32(ListView1.Items[i].SubItems[5].Text);
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    return k;
}

basically i need to get the sum of a particluar column from a list view which is in telerik so if anyone can help me out please do help Thanks in Advance


Solution

  • ok so here is the solution itself thanks @checho for helping me out really appreciate your help

      foreach (ListViewDataItem item in radListView1.Items)
                {
                    //k += (int)item["Column 1"].ToString();
                    //this code helped me 
    
                    k += Convert.ToInt32(item["Column 1"].ToString());
                }