protected void btnSubmitGradPROG_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtInsertGradPROGID.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ รหัสสาขาวิชาที่จบการศึกษาสูงสุด')", true); return; } if (string.IsNullOrEmpty(txtInsertGradPROGName.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ ชื่อสาขาวิชาที่จบการศึกษาสูงสุด')", true); return; } ClassGradProgram gp = new ClassGradProgram(); gp.GRAD_PROG_ID = txtInsertGradPROGID.Text; gp.GRAD_PROG_NAME = txtInsertGradPROGName.Text; if (gp.CheckUseGradProgramID()) { gp.InsertGradProgram(); BindData(); ClearData(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('มีรหัสสาขาวิชาที่จบการศึกษาสูงสุดนี้ อยู่ในระบบแล้ว !')", true); } }
void BindData1() { ClassGradProgram gp = new ClassGradProgram(); DataTable dt = gp.GetGradProgramSearch(txtSearchGradPROGID.Text, txtSearchGradPROGName.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
void BindData() { ClassGradProgram gp = new ClassGradProgram(); DataTable dt = gp.GetGradProgram("", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
protected void btnSearchRefresh_Click(object sender, EventArgs e) { ClearData(); ClassGradProgram gp = new ClassGradProgram(); DataTable dt = gp.GetGradProgram("", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
protected void modDeleteCommand(Object sender, GridViewDeleteEventArgs e) { string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); ClassGradProgram gp = new ClassGradProgram(); gp.GRAD_PROG_ID = id; gp.DeleteGradProgram(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true); GridView1.EditIndex = -1; BindData1(); }
protected void modUpdateCommand(Object sender, GridViewUpdateEventArgs e) { TextBox txtGradPROGIDEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtGradPROGIDEdit"); TextBox txtGradPROGNameEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtGradPROGNameEdit"); ClassGradProgram gp = new ClassGradProgram(txtGradPROGIDEdit.Text , txtGradPROGNameEdit.Text); gp.UpdateGradProgram(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true); GridView1.EditIndex = -1; BindData1(); }
protected void btnSearchGradPROG_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtSearchGradPROGID.Text) && string.IsNullOrEmpty(txtSearchGradPROGName.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true); return; } else { ClassGradProgram gp = new ClassGradProgram(); DataTable dt = gp.GetGradProgramSearch(txtSearchGradPROGID.Text, txtSearchGradPROGName.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } }