Welcome to the Xceed Community | Help
Community Search  
More Search Options

How to get cell value from selected row

Sort Posts: Previous Next
  •  02-24-2012, 5:34 PM Post no. 31742

    How to get cell value from selected row

    In the SelectedRowsChanged event, how to get the value of a selected row's cell by column name

     

    I'm expecting something like

     

    gridControl1.SelectedRows[0].Cells[<field name>].value

     

    but Cells collection doesn't exist in this context....

     

    Thanks

  •  02-24-2012, 6:11 PM Post no. 31743 in reply to 31742

    Re: How to get cell value from selected row

    Found the solution but it's ULTRA COUNTER INTUITIVE: you need to cast the collection of  Xceed.Grid.Row selectedRows property output by a - most likeley - inherited class CellRow. Thus, answer is:

    (Xceed.Grid.CellRow)gridControl1.SelectedRows[0].Cells[<field name>].Value

  •  06-11-2012, 7:27 AM Post no. 32232 in reply to 31743

    Re: How to get cell value from selected row

    Frederic, I am in similar situation where I have to get cell value from row, using QTP.

    Thank you for you reply, but I am not  under "you need to cast the collection of  Xceed.Grid.Row selectedRows property output by a - most likeley - inherited class CellRow."

     In my case what is "gridcontrol1"?

    if I execute below code, I get number of rows
    Set x = SwfWindow("FormName").SwfObject("grid").Object.DataRows
    y = x.Count
    MsgBox y

    if I execute below code,
    Set t = SwfWindow("FormName").SwfObject("grid").Object.DataRows(0).
    no options are displayed by QTP.
    When I type "." QTP gives some options, example "SwfWindow("FormName").SwfObject("grid").Object.DataRows." QTP displayes count etc options and I can select, but when I type
    "Set t = SwfWindow("FormName").SwfObject("grid").Object.DataRows(0)." no options are displayed

    Can you please help me?

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.