I have a Gridview with values MachineGroupID, MachineGroupName, MachineGroupDesc and so on..

I have a delete command in the gridview, when I clicked is supposed to delete the selected row.

Now i have a code which tells me which row is selected.

```
 protected void LinkButton1_Click(object sender, EventArgs e)
 {
        LinkButton btn = (LinkButton)sender;
        GridViewRow row = (GridViewRow)btn.NamingContainer;
        string machineID = (String)GridView1.SelectedValue;
        if (row != null)
        {
            LinkButton LinkButton1 = (LinkButton)sender;

            // Get reference to the row that hold the button
            GridViewRow gvr = (GridViewRow)LinkButton1.NamingContainer;

            // Get row index from the row
            int rowIndex = gvr.RowIndex;
            string str = rowIndex.ToString();
            //string str = GridView1.DataKeys[row.RowIndex].Value.ToString();
            RemoveData(str); //call the delete method
       }
 }

```

I want to get the MachineGroupID present in the row so that i can pass that value and delete the record from the database and the gridview?

Thanks