protected void ButtonAddStudent_Click(object sender, EventArgs e) { if (TextBoxID.Text.Equals("") || TextBoxName.Text.Equals("") || TextBoxAge.Text.Equals("") || TextBoxUniversity.Text.Equals("")) { Response.Write("<script language='javascript'>alert('Please fill all the fields.');</script>"); } else { Student stu = new Student(); stu.Student_Age = Convert.ToInt32(TextBoxAge.Text); stu.Student_Name = TextBoxName.Text; stu.Student_Id = TextBoxID.Text; stu.Student_University = TextBoxUniversity.Text; StudentsDBDataClassesDataContext db = new StudentsDBDataClassesDataContext(); db.Students.InsertOnSubmit(stu); db.SubmitChanges(); TextBoxID.Text = ""; TextBoxAge.Text = ""; TextBoxName.Text = ""; TextBoxUniversity.Text = ""; } }
partial void DeleteStudent(Student instance);
partial void UpdateStudent(Student instance);
partial void InsertStudent(Student instance);