protected void BtnAdd_Click(object sender, EventArgs e) { dtcheck = obj.CheckTeacher(Convert.ToInt32(ddnteacher.SelectedValue)); if (dtcheck.Rows.Count > 0) { lblmsg.Text = "Teacher Already Appointed As a Class Teacher"; } if (dtcheck.Rows.Count <= 0) { i = obj.AddClassTeacher(Convert.ToInt32(ddnteacher.SelectedValue), Convert.ToInt32(ddnclass.SelectedValue), Convert.ToInt32(ddnsec.SelectedValue), "Yes", "Admin", 1, DateTime.Now.ToString()); if (i > 0) { lblmsg.Text = "Data Has Been Added"; BindData(); ClearFields(); Response.Redirect("AddClassTeacher.aspx"); } } }