This article from: http://www.cnblogs.com/xiaofengfeng/archive/2011/09/15/2177625.html
Today, the gridcontrol control is used, and a double-click event of the gridview is required, because the Message is displayed only when the row is double-clicked. I didn't implement it with the Double_Click of the gridview. Later I thought of MouseDown, first, you still need to set gridview1.OptionsBehavior. set EditablefalseBelow is the code: |
Skelta BPM. NET (World's first. NET workflow engine) Visual WebGui (perfect user interface solution) |
List & Label (Chart report generation control) DXperience Uni Premium platinum edition (exclusive to huidu) |
// Double-click the row to display the nodeDetail information. |
private void gridView1_MouseDown(object sender, MouseEventArgs e) |
DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = gridView1.CalcHitInfo(new Point(e.X,e.Y)); |
if (e.Button == MouseButtons.Left && e.Clicks == 2) |
// Determine whether the cursor is within the row range |
// Obtain the information of the selected row |
string nodeName = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "nodeName").ToString(); |
//string nodeName = gridView1.GetRowCellValue(gridView1.GetSelectedRows()[0], "nodeName").ToString(); |
string sql = "select nodeDetail from treelist where nodeName = '" + nodeName + "'"; |
SqlCommand comm = new SqlCommand(sql, conn); |
MessageBox.Show(comm.ExecuteScalar().ToString(), "Detail"); |
MessageBox.Show(ex.Message, "Error"); |