To Get Summary Row Values in to Variable

4 posts, 0 answers
  1. sameer
    sameer avatar
    1 posts
    Member since:
    Jan 2011

    Posted 13 Jan 2011 Link to this post

    I have a Summary Row in the bottom of the Grid, I want to get the value of summaryrowitem in to the variable. how i can do this ?
    Secondly, how we can do the conditional formatting of the summary row.
  2. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 13 Jan 2011 Link to this post

    Hello Sameer,

    I have solved a problem like this in this thread, i have provided a few options there please take a look at those and if you need more assistance i will be happy to help. If it were up to me i would suggest my second reply (that is not marked) because if offers a clean way to get the values of the SummaryItems without the need to store them in a variable, dictionary or other things.
    Or if you don't need such complex things, you can just handle the GroupSummaryEvaluate event and take the value there and store it in a variable.

    Second question coming up

    Best Regards,
    Emanuel Varga
    Telerik WinForms MVP
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 13 Jan 2011 Link to this post

    Hello again, as promised,

    Just use ViewRowFormatting event, like so:
    void radGridView1_ViewRowFormatting(object sender, RowFormattingEventArgs e)
    {
        if (e.RowElement is GridSummaryRowElement)
        {
            e.RowElement.SetValue(LightVisualElement.BackColorProperty, Color.Red);
            e.RowElement.DrawFill = true;
        }
        else
        {
            e.RowElement.ResetValue(LightVisualElement.BackColorProperty);
            e.RowElement.ResetValue(LightVisualElement.DrawFillProperty);
        }
    }

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
    Telerik WinForms MVP
  5. Salman
    Salman avatar
    3 posts
    Member since:
    Jul 2014

    Posted 01 Jul 2014 in reply to Emanuel Varga Link to this post

    Yes You can have summary row Items and their values too.....
    After Inserting a grid view and making a row summary item
    goto the properties of GridView you inserted and Select
    GroupSummaryEvaluate()
    event from Properties Event window Now goto the code section of windows form and there u will see
    int count=0;
    Private Void RadGridView1_GroupSummaryEvaluate(object Sender, GroupSummaryEvaluateArg e){
    //Here you will write the following code in the code section
    try
          this.cursor=cursors.waitcursor;
          object value=e.value;
      if(count==0){
            messagebox.show(value.toString());
          count++;
       }
      else{
            messagebox.show(value.toString());
        count=0;
       }
    }
    catch(exception ex){
                       ;
    }
    finally{
          this.cursor=cursors.default;
    }
    /*It will give us value one by as if we have group summary items like count the items in the list and other grand total of the items in the list, it will show them to us one by one means it will show Item count of list first and then will show us total of the items It works*/
    }
Back to Top