void BindData1() { ClassTeachISCED ti = new ClassTeachISCED(); DataTable dt = ti.GetTeachISCEDSearch(txtSearchISCED_ID.Text, txtSearchISCED_ID_OLD.Text, txtSearchISCED_NAME_TH.Text, txtSearchISCED_NAME_ENG.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
void BindData() { ClassTeachISCED ti = new ClassTeachISCED(); DataTable dt = ti.GetTeachISCED("", "", "", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
protected void btnSearchRefresh_Click(object sender, EventArgs e) { ClearData(); ClassTeachISCED ti = new ClassTeachISCED(); DataTable dt = ti.GetTeachISCED("", "", "", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
protected void modDeleteCommand(Object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value); ClassTeachISCED ti = new ClassTeachISCED(); ti.ID = id; ti.DeleteTeachISCED(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true); GridView1.EditIndex = -1; BindData1(); }
protected void btnSearchTeachISCED_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtSearchISCED_ID.Text) && string.IsNullOrEmpty(txtSearchISCED_ID_OLD.Text) && string.IsNullOrEmpty(txtSearchISCED_NAME_TH.Text) && string.IsNullOrEmpty(txtSearchISCED_NAME_ENG.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true); return; } else { ClassTeachISCED ti = new ClassTeachISCED(); DataTable dt = ti.GetTeachISCEDSearch(txtSearchISCED_ID.Text, txtSearchISCED_ID_OLD.Text, txtSearchISCED_NAME_TH.Text, txtSearchISCED_NAME_ENG.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } }
protected void modUpdateCommand(Object sender, GridViewUpdateEventArgs e) { TextBox txtTeachISCEDIDEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtTeachISCEDIDEdit"); TextBox txtTeachISCEDidOldEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtTeachISCEDidOldEdit"); TextBox txtTeachISCEDThaiEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtTeachISCEDThaiEdit"); TextBox txtTeachISCEDEnglishEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtTeachISCEDEnglishEdit"); Label lblTeachISCEDseqEdit = (Label)GridView1.Rows[e.RowIndex].FindControl("lblTeachISCEDseqEdit"); ClassTeachISCED ti = new ClassTeachISCED(txtTeachISCEDIDEdit.Text , Convert.ToInt32(txtTeachISCEDidOldEdit.Text) , txtTeachISCEDThaiEdit.Text , txtTeachISCEDEnglishEdit.Text , Convert.ToInt32(lblTeachISCEDseqEdit.Text)); ti.UpdateTeachISCED(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true); GridView1.EditIndex = -1; BindData1(); }
protected void btnSubmitTeachISCED_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtInsertISCED_ID.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ รหัสกลุ่มสาขาวิชาที่สอน')", true); return; } if (string.IsNullOrEmpty(txtInsertISCED_ID_OLD.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ รหัสกลุ่มสาขาวิชาที่สอนเก่า')", true); return; } if (string.IsNullOrEmpty(txtInsertISCED_NAME_TH.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ ชื่อกลุ่มสาขาวิชาที่สอนภาษาไทย')", true); return; } if (string.IsNullOrEmpty(txtInsertISCED_NAME_ENG.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ ชื่อกลุ่มสาขาวิชาที่สอนภาษาอังกฤษ')", true); return; } ClassTeachISCED ti = new ClassTeachISCED(); ti.TEACH_ISCED_ID = txtInsertISCED_ID.Text; ti.TEACH_ISCED_ID_OLD = Convert.ToInt32(txtInsertISCED_ID_OLD.Text); ti.TEACH_ISCED_NAME_TH = txtInsertISCED_NAME_TH.Text; ti.TEACH_ISCED_NAME_ENG = txtInsertISCED_NAME_ENG.Text; ti.InsertTeachISCED(); BindData(); ClearData(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true); }