Thread: ASP.NET/Show position in the data from GridView

Show position in the data from GridView
string sstr = "";

        foreach (GridViewRow grv in GridView1.Rows )
        {
            if (((CheckBox)grv.FindControl("chkGrid")).Checked)
            {
                int index = grv.RowIndex;
                int id = (int)GridView1.DataKeys[index].Values["CategoryID"];
                sstr = sstr+"," + id.ToString();
            }
        }