Task-Based Help / Getting a Value from a Cell
In This Topic
Getting a Value from a Cell
In This Topic

You can easily read the value of a cell in a grid by using the NewEditIndex property to get the index of the row being edited.

For example, use the following code:

To write the code in Visual Basic:

Visual Basic
Copy Code
' Get the index of the row being edited.
Protected Sub C1GridView1_RowEditing(sender As Object, e As C1.Web.Wijmo.Controls.C1GridView.C1GridViewEditEventArgs)
        Handles C1GridView1.RowEditing
        Dim idx As Integer
        Dim id As String
        idx = e.NewEditIndex
' Get the text in a cell in the edited row. id = C1GridView1.Rows(idx).Cells(0).Text End Sub

To write the code in C#:

C#
Copy Code
// Get the index of the row being edited.
protected void C1GridView1_RowEditing(object sender, C1.Web.Wijmo.Controls.C1GridView.C1GridViewEditEventArgs e)
     {
       int idx = 0;
       string id;
       idx = e.NewEditIndex;
       
       // Get the text in a cell in the edited row.
       id = C1GridView1.Rows[idx].Cells[0].Text;
      }

The above code will get a numeric value in a specified column in the row that has been edited.

See Also