foreach (DataListItem dli in DataList1.Items)
{
string id = DataList1.DataKeys[dli.ItemIndex].ToString();
Response.Write("<script>alert('" + id + "')</script>");
}
foreach (DetailsViewRow dvr in DetailsView1.Rows)
{
string id = DetailsView1.DataKeys[dvr.RowIndex].Value.ToString();
// string s = dvr.Cells[0].Text;
Response.Write("<script>alert('" + id + "')</script>");
}
foreach (RepeaterItem ri in Repeater1.Items)
{
string id = Repeater1.DataKeys[ri.ItemIndex.ToString();
Response.Write("<script>alert('" + id + "')</script>");
}
foreach (GridViewRow drv in GridView1.Rows)
{
string id = GridView1.DataKeys[drv.RowIndex].Value.ToString();
// string s = drv.Cells[0].Text;
Response.Write("<script>alert('" + id + "')</script>");
}