How can i Get selected cell value?

3 posts, 2 answers
  1. Jeongmin
    Jeongmin avatar
    7 posts
    Member since:
    Feb 2013

    Posted 01 Aug 2013 Link to this post

    How can i Get selected cell value and all value ?

    I test code. but GetCellElement method always return null.
    what's wrong? Help me.

     

    private void rndButton1_Click(object sender, EventArgs e)
            {
                foreach (PivotGroupNode rowNode in this.radPivotGrid1.PivotGridElement.GetRowGroups())
                {
                    if (rowNode.Group == null) continue;
                    foreach (PivotGroupNode columnNode in this.radPivotGrid1.PivotGridElement.GetColumnGroups())
                    {
                        if (columnNode.Group == null) continue;

                        var cell = this.radPivotGrid1.PivotGridElement.GetCellElement(columnNode, rowNode);

                        if (cell == null) continue;  <== always return null
                        Console.Write(cell.Value);
                    }
                }
            }

  2. Answer
    Barry
    Barry avatar
    18 posts
    Member since:
    Jul 2008

    Posted 01 Aug 2013 Link to this post

    You have the reversed the columnNode and row Node in the GetCellElelment method's parameters.

    Your code is:
    var cell = this.radPivotGrid1.PivotGridElement.GetCellElement(columnNode, rowNode);

    The correct code is:
    var cell = rPivot.PivotGridElement.GetCellElement(rowNode, columnNode);

    I am using the following line to get a cell value:
    CellAggregateValue value = this.rPivot.PivotGridElement.GetAggregateValue(rowNode.Group, columnNode.Group, true, true);

    I had done exactly the same as you - reversed the order of the rowNode & columnNode parameters. It was looking at you posting that enabled me to sort out my own problem!

    Thanks for the posting.

    Barry
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Answer
    Peter
    Admin
    Peter avatar
    1148 posts

    Posted 05 Aug 2013 Link to this post

    Hello,

    I can confirm that the Barry's approach is the right way to get the cell value.

    @Barry, I have updated your 
    Telerik Points for the community efforts.

    Regards,
    Peter
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top