protected void Btn_addNewWorkAreaAdd_Click(object sender, EventArgs e) { con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "INSERT INTO[ADD_WORKAREA]([DEPARTMENT], [REQUEST_AMOUNT], [STUDY_TERM], [STUDY_YEAR], [AUTH_FIRSTNAME], [AUTH_LASTNAME], [AUTH_ID], [STATUS], [ADMIN_ID], [TIMESTAMP]) VALUES(N'" + Tb_addNewWorkAreaName.Text + "', '" + Ddl_addNewWorkAreaAmount.Text + "', '" + Ddl_addNewWorkAreaStudyYear.Text + "', '" + Ddl_addNewWorkAreaStudyYears.Text + "', N'" + Tb_addNewWorkAreaAuthFName.Text + "', N'" + Tb_addNewWorkAreaAuthLname.Text + "', '" + Tb_addNewWorkAreaAuthID.Text + "', N'" + Ddl_addNewWorkAreaStatus.Text + "', '" + Tb_addNewWorkAreaAdminID.Text + "', '" + DateTime.Now + "')"; cmd.ExecuteNonQuery(); con.Close(); Gv_addWorkArea.DataBind(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "addNewWorkAreaModalCenter", "$('#addNewWorkAreaModalCenter').modal('hide');", true); }
protected void Btn_addWorkAreaSearch_Click(object sender, EventArgs e) { Thread.Sleep(1000); string DEPARTMENT = Tb_addWorkAreaFilter.Text; string Filter = ""; //Colum of data table if (DEPARTMENT != "") { Filter = Filter + "DEPARTMENT like '%" + DEPARTMENT + "%' and "; } //Add filter expression of datasource if (Filter.Length > 0) { string FinalFilter = Filter.Remove(Filter.Length - 4, 3); SqlDataSourceADD_WORKAREA.FilterExpression = FinalFilter; } else { Gv_addWorkArea.DataBind(); } }