Friday, March 18, 2011

How to Get Grid View Data Keys Values From Using foreach GridViewRow

        protected void BtnCentre_Click(object sender, EventArgs e)
        {
           
            foreach (GridViewRow Item in GrdCentre.Rows)
            {
                CheckBox GrdChkBox = (CheckBox)(Item.FindControl("ChkCentre"));
                if (GrdChkBox.Checked == true)
                {
                    string CircleId = GrdCentre.DataKeys[Item.RowIndex].Values[0].ToString();
                    string CenterId = GrdCentre.DataKeys[Item.RowIndex].Values[1].ToString();
                    string CorpBillingId = GrdCentre.DataKeys[Item.RowIndex].Values[2].ToString();
                }
            }
        }

No comments:

Post a Comment