Ticket T156269
Visible to All Users

Get row cell value with double-click on a grid row or cell

created 11 years ago (modified 11 years ago)

Hi,
Can you a give me an example demonstrates how get row cell value with double-click on a grid row or cell .
Thanks.

Answers approved by DevExpress Support

created 11 years ago

Hi,
You can handle a cell double click as shown in the A2934: How to handle a double-click on a grid row or cell KB article. To obtain a cell value, you can use the GridView.GetRowCellValue method that requires RowHandle and Column as parameters.
RowHandle and Column are available through GridHitInfo in the DoRowDoubleClick method.
See also the E595: How to handle a double-click on a grid row or cell example.

    Show previous comments (1)
    DevExpress Support Team 11 years ago

      Hi,

      As stated in my answer, to obtain a cell value, use the GridView.GetRowCellValue method. In the example, I suggested you can see that when a double click occurs, the DoRowDoubleClick method is called. Call the GridView.GetRowCellValue method in this method to access a cell value.

      C#
      private static void DoRowDoubleClick(GridView view, Point pt) { GridHitInfo info = view.CalcHitInfo(pt); if(info.InRow || info.InRowCell) { string colCaption = info.Column == null ? "N/A" : info.Column.GetCaption(); object val = view.GetRowCellValue(info.RowHandle, info.Column); if(val != null) MessageBox.Show(string.Format("DoubleClick on row: {0}, column: {1}, value: {2}", info.RowHandle, colCaption, val)); } }
      C#
      Private Shared Sub DoRowDoubleClick(ByVal view As GridView, ByVal pt As Point) Dim info As GridHitInfo = view.CalcHitInfo(pt) If info.InRow OrElse info.InRowCell Then Dim colCaption As String = If(info.Column Is Nothing, "N/A", info.Column.GetCaption()) Dim val As Object = view.GetRowCellValue(info.RowHandle, info.Column) If val IsNot Nothing Then MessageBox.Show(String.Format("DoubleClick on row: {0}, column: {1}, value: {2}", info.RowHandle, colCaption, val)) End If End If End Sub

      Keep us posted of your results.

      A A
      Allah rakha sahib 10 years ago

        How to get value from another column while click is done on another .

        Alisher (DevExpress Support) 10 years ago

          Hi,

          We will answer you in the Get value from particular column on double click on another column ticket. Please refer to it for further correspondence.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.