gridview id using label
protected void finddemoresult()
{
string cs = ConfigurationManager. AppSettings["victedudb"];
cn = new SqlConnection(cs);
cn.Open();
string k = "select uname,email,category from demoresult where category='"+dropcategory.Text+ "' group by uname,email,category";
cm = new SqlCommand(k, cn);
dr = cm.ExecuteReader();
GridView1.DataSource = dr;
GridView1.DataBind();
dr.Close();
foreach (GridViewRow row1 in GridView1.Rows)
{
Label lblID = (Label)row1.FindControl(" LBLID");
string k1 = "select sum(marks) from demoresult where email='" + lblID.Text + "'";
cm = new SqlCommand(k1, cn);
row1.Cells[4].Text = cm.ExecuteScalar().ToString();
}
}