protected void btnSAVE_Click(object sender, EventArgs e) { uint check_uint; if (!uint.TryParse(txtWorkloadValue.Text, out check_uint)) { MsgValidate("โปรดตรวจสอบค่า ชั่วโมงอ้างอิง"); } else if (!uint.TryParse(txtMaxWorkloadValue.Text, out check_uint)) { MsgValidate("โปรดตรวจสอบค่า หน่วยกิตรวม"); } else { WorkLoadConfigData work_load = new WorkLoadConfigData(); work_load.LecturerType = ddlLecturerType.SelectedValue; work_load.LecturerPosition = ddlPosition.SelectedValue; work_load.HourReference = Convert.ToUInt16(txtWorkloadValue.Text); work_load.TotalCredit = Convert.ToUInt16(txtMaxWorkloadValue.Text); string result = new WorkLoadConfig().insertWorkLoadConfig(work_load); if (result == "OK") { divSuccess.Visible = true; showDiv.Visible = false; } else { MsgValidate("ไม่สามารถเพิ่มภาระงานสอนตามตำแหน่ง กรุณาทำใหม่อีกครั้ง"); } } }
public string insertWorkLoadConfig(WorkLoadConfigData dataInsert) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = ""; sql = "Insert Into WorkLoadConfig(LecturerType, LecturerPosition, HourReference, TotalCredit) Values('" + dataInsert.LecturerType + "','" + dataInsert.LecturerPosition + "'," + dataInsert.HourReference + "," + dataInsert.TotalCredit + ")"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); HttpContext.Current.Session["response"] = "Unit Test:WorkLoadConfig:insertWorkLoadConfig" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(response); }
public WorkLoadConfigData getWorkLoadConfig(string lecturer_type, string lecturer_position) { string response = ""; WorkLoadConfigData workload_data = new WorkLoadConfigData(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Select * From WorkLoadConfig Where LecturerType='" + lecturer_type + "' And LecturerPosition='" + lecturer_position + "'"; try { oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { workload_data.LecturerType = rowData["LecturerType"].ToString(); workload_data.LecturerPosition = rowData["LecturerPosition"].ToString(); workload_data.HourReference = Convert.ToUInt16(rowData["HourReference"].ToString()); workload_data.TotalCredit = Convert.ToUInt16(rowData["TotalCredit"].ToString()); } } catch (Exception e) { response = e.Message.ToString(); HttpContext.Current.Session["response"] = "Unit Test:WorkLoadConfig:getWorkLoadConfig " + response; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(workload_data); }
public string updateWorkLoadConfig(WorkLoadConfigData updateData) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Update WorkLoadConfig Set HourReference=" + updateData.HourReference + ", TotalCredit=" + updateData.TotalCredit + " Where LecturerType='" + updateData.LecturerType + "' And LecturerPosition='" + updateData.LecturerPosition + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString(); HttpContext.Current.Session["response"] = "Unit Test:WorkLoadConfig:updateWorkLoadConfig" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(response); }
private void createCreditTable2() { CourseData course_data = new Course().getCourse(available_data.Course_Code); tblSubCredit.Rows.Clear(); // แบ่งโหลด string[] ar5 = { "ชื่ออาจารย์", "ภาระงานสอน ชั่วโมง/หน่วยกิต", "ชั่วโมงสอนอ้างอิง", "หน่วยกิตรวม", "แบ่งหน่วยกิต" }; Table tb5 = new Table(); tb5.Attributes.Add("class", "table table-bordered table-striped"); tb5.Attributes.Add("id", "dt_basic5"); TableHeaderRow tRowHead5 = new TableHeaderRow(); tRowHead5.TableSection = TableRowSection.TableHeader; for (int cellCtr = 1; cellCtr <= ar5.Length; cellCtr++) { // Create a new cell and add it to the row. TableHeaderCell cellHead5 = new TableHeaderCell(); cellHead5.Text = ar5[cellCtr - 1]; cellHead5.Attributes.Add("class", "text-align-center"); tRowHead5.Cells.Add(cellHead5); } tb5.Rows.Add(tRowHead5); int i = 0; List <LecturerTableData> new_lecturertable = new List <LecturerTableData>(); //List<LecturerTableData> tmp = new List<LecturerTableData>(); new_lecturertable = lecturertable.OrderBy(o => o.Lecturer).ToList(); //string lec_code = ""; //foreach (LecturerTableData lect_data in tmp) // { // if (lect_data.Lecturer != lec_code) // { // new_lecturertable.Add(lect_data); // } // lec_code = lect_data.Lecturer; // } foreach (LecturerTableData lect_data in new_lecturertable) { subcreditData = (List <SubCreditData>)Session["subCredit"]; SysUser user1 = new SysUser(); user1 = new SysUser().getSysUser(lect_data.Lecturer); Sysuser2 user2 = new Sysuser2(); user2 = new Sysuser2().getSysuser2(lect_data.Lecturer); TableRow tRowBody5 = new TableRow(); tRowBody5.TableSection = TableRowSection.TableBody; TableCell cellLecName = new TableCell(); cellLecName.Text = lecturerObj.getLecturer(lect_data.Lecturer).First_ThaiName + " " + lecturerObj.getLecturer(lect_data.Lecturer).Family_ThaiName; tRowBody5.Cells.Add(cellLecName); WorkLoadConfigData workload = new WorkLoadConfigData(); workload = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, user1.Position); TableCell cellLoad = new TableCell(); cellLoad.Text = workload.HourReference.ToString() + " / " + workload.TotalCredit.ToString(); cellLoad.Attributes.Add("class", "text-align-center"); tRowBody5.Cells.Add(cellLoad); TableCell cellHourRef = new TableCell(); cellHourRef.Text = new WorkLoadCalculate().getHourRef(lect_data.AcademicYear, lect_data.Semester, lect_data.Lecturer).ToString(); cellHourRef.Attributes.Add("class", "text-align-center"); tRowBody5.Cells.Add(cellHourRef); TableCell cellTotalCredit = new TableCell(); cellTotalCredit.Text = new WorkLoadCalculate().getTotalCredit(lect_data.AcademicYear, lect_data.Semester, lect_data.Lecturer).ToString(); cellTotalCredit.Attributes.Add("class", "text-align-center"); tRowBody5.Cells.Add(cellTotalCredit); int credit = course_data.Credit; if (lect_data.Course_Type == "1") { if (course_data.Practice != 0) { credit = course_data.Theory; } else { credit = course_data.Credit; } } else if (lect_data.Course_Type == "2") { if (course_data.Theory != 0) { credit = course_data.Practice / 2; } else { credit = course_data.Credit; } } TableCell cellSubCredit = new TableCell(); txtSubCredit = new TextBox[new_lecturertable.Count]; txtSubCredit[i] = new TextBox(); txtSubCredit[i].ID = lect_data.Lecturer + lect_data.Teaching_Day + lect_data.Teaching_Start_Time.Replace(":", "").Replace(".", "") + lect_data.Teaching_End_Time.Replace(":", "").Replace(".", ""); txtSubCredit[i].MaxLength = 5; txtSubCredit[i].Width = 50; txtSubCredit[i].AutoPostBack = true; txtSubCredit[i].Text = subcreditData[i].ToString(); txtSubCredit[i].Attributes.Add("class", "text-align-center"); txtSubCredit[i].TextChanged += new EventHandler(txtChanged); cellSubCredit.Attributes.Add("class", "text-align-center"); cellSubCredit.Controls.Add(txtSubCredit[i]); tRowBody5.Cells.Add(cellSubCredit); tb5.Rows.Add(tRowBody5); i++; } TableRow row5 = new TableRow(); TableCell cell5 = new TableCell(); cell5.Controls.Add(tb5); row5.Cells.Add(cell5); tblSubCredit.Rows.Add(row5); }
protected void Page_Load(object sender, EventArgs e) { if (Session["login_data"] == null) { Response.Redirect("../index.aspx"); } else { //ตรวจสอบสิทธิ์ login_data = (UserLoginData)Session["login_data"]; if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty)) { /*=============================*/ if (!Page.IsPostBack) { fail.Visible = false; divSuccess.Visible = false; // ประเภทอาจารย์ ddlLecturerType.Items.Clear(); List <LecturerType> lec_type = new List <LecturerType>(); lec_type = new LecturerType().getLecturerType2(); foreach (LecturerType row in lec_type) { ddlLecturerType.Items.Insert(ddlLecturerType.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode)); } //=========== // ตำแหน่ง ddlPosition.Items.Clear(); List <BoardPosData> position_data = new List <BoardPosData>(); position_data = new BoardPos().getBoardPos(); foreach (BoardPosData pos in position_data) { ddlPosition.Items.Insert(ddlPosition.Items.Count, new ListItem(pos.Position_Thai, pos.Position_Code)); } try { string lecturer_type = Request.QueryString["type"]; string lecturer_position = Request.QueryString["position"]; WorkLoadConfigData workload_data = new WorkLoadConfigData(); workload_data = new WorkLoadConfig().getWorkLoadConfig(lecturer_type, lecturer_position); ddlLecturerType.Items.FindByValue(lecturer_type).Selected = true; ddlPosition.Items.FindByValue(lecturer_position).Selected = true; txtWorkloadValue.Text = workload_data.HourReference.ToString(); txtMaxWorkloadValue.Text = workload_data.TotalCredit.ToString(); ddlLecturerType.Enabled = false; ddlPosition.Enabled = false; } catch (Exception err) { Session["response"] = err.ToString(); Response.Redirect("err_response.aspx"); } } /*=============================*/ } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["login_data"] == null) { Response.Redirect("../index.aspx"); } else { //ตรวจสอบสิทธิ์ login_data = (UserLoginData)Session["login_data"]; if (autro_obj.CheckGroupUser(login_data, group_var.officer_department) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.lecturer)) { /*=============================*/ if (!Page.IsPostBack) { config_data = new SystemConfig().getConfig(); txtACADEMIC_YEAR.Text = config_data.AcademicYear; academic_year = config_data.AcademicYear; ddlSEMESTER.Items.FindByValue(config_data.Semester).Selected = true; } academic_year = txtACADEMIC_YEAR.Text; // Head Table string[] ar = { "ลำดับ", "ชื่ออาจารย์", "ตำแหน่ง", "ชั่วโมงสอนอ้างอิง", "หน่วยกิตรวม", "ภาระงานสอน ชั่วโมง/หน่วยกิต", "รายละเอียด" }; Table tb1 = new Table(); tb1.Attributes.Add("class", "table table-bordered table-striped table-hover"); tb1.Attributes.Add("id", "dt_basic"); TableHeaderRow tRowHead = new TableHeaderRow(); tRowHead.TableSection = TableRowSection.TableHeader; for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++) { TableHeaderCell cellHead = new TableHeaderCell(); cellHead.Text = ar[cellCtr - 1]; cellHead.Attributes.Add("class", "text-center"); tRowHead.Cells.Add(cellHead); } tb1.Rows.Add(tRowHead); List <SysUser> lecturerALL = new List <SysUser>(); if (autro_obj.CheckGroupUser(login_data, group_var.lecturer)) { SysUser lecturer = new SysUser().getSysUser(login_data.Nation_ID); lecturerALL.Add(lecturer); } else { lecturerALL = new SysUser().getSysUser(); } int num = 1; foreach (SysUser lec in lecturerALL) { TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; TableCell cellNum = new TableCell(); cellNum.Attributes.Add("class", "text-center"); cellNum.Text = num.ToString(); tRowBody.Cells.Add(cellNum); TableCell cellName = new TableCell(); cellName.Text = new AcademicPosition().getAcademicPosition(lec.AcademicPositionCode).AcademicPositionThName + " " + lec.ThName + " " + lec.ThSurName; tRowBody.Cells.Add(cellName); TableCell cellPosition = new TableCell(); cellPosition.Attributes.Add("class", "text-center"); cellPosition.Text = new BoardPos().getBoardPos(lec.Position).Position_Thai; tRowBody.Cells.Add(cellPosition); TableCell cellHourRef = new TableCell(); cellHourRef.Attributes.Add("class", "text-center"); cellHourRef.Text = new WorkLoadCalculate().getHourRef(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lec.IdCode).ToString(); tRowBody.Cells.Add(cellHourRef); TableCell cellTotalCredit = new TableCell(); cellTotalCredit.Attributes.Add("class", "text-center"); cellTotalCredit.Text = new WorkLoadCalculate().getTotalCredit(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lec.IdCode).ToString(); tRowBody.Cells.Add(cellTotalCredit); Sysuser2 user2 = new Sysuser2(); user2 = new Sysuser2().getSysuser2(lec.IdCode); WorkLoadConfigData workload = new WorkLoadConfigData(); workload = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, lec.Position); TableCell cellLoad = new TableCell(); cellLoad.Attributes.Add("class", "text-center"); cellLoad.Text = workload.HourReference.ToString() + " / " + workload.TotalCredit.ToString(); tRowBody.Cells.Add(cellLoad); TableCell cellDetail = new TableCell(); cellDetail.Attributes.Add("class", "text-center"); if (autro_obj.CheckGroupUser(login_data, group_var.lecturer)) { if (login_data.Nation_ID == lec.IdCode) { string urlDetail = "detail_WorkLoad.aspx?lecturer=" + lec.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue; HyperLink hypDetail = new HyperLink(); hypDetail.Text = "<h4><i class='fa fa-search'></i></h4>"; hypDetail.NavigateUrl = urlDetail; hypDetail.ToolTip = "Detail"; hypDetail.Target = "_Blank"; cellDetail.Controls.Add(hypDetail); } else { string urlDetail = "#"; HyperLink hypDetail = new HyperLink(); hypDetail.Text = "<h4><i class='fa fa-lock'></i></h4>"; hypDetail.NavigateUrl = urlDetail; hypDetail.ToolTip = "Detail"; hypDetail.Target = "_Blank"; cellDetail.Controls.Add(hypDetail); } } else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { string urlDetail = "detail_WorkLoad.aspx?lecturer=" + lec.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue; HyperLink hypDetail = new HyperLink(); hypDetail.Text = "<h4><i class='fa fa-search'></i></h4>"; hypDetail.NavigateUrl = urlDetail; hypDetail.ToolTip = "Detail"; hypDetail.Target = "_Blank"; cellDetail.Controls.Add(hypDetail); } else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { bool authorized = false; List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department); foreach (string dep in department_authorized) { if (dep == lec.DepartmentCode) { authorized = true; break; } } if (authorized == true) { string urlDetail = "detail_WorkLoad.aspx?lecturer=" + lec.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue; HyperLink hypDetail = new HyperLink(); hypDetail.Text = "<h4><i class='fa fa-search'></i></h4>"; hypDetail.NavigateUrl = urlDetail; hypDetail.ToolTip = "Detail"; hypDetail.Target = "_Blank"; cellDetail.Controls.Add(hypDetail); } else { string urlDetail = "#"; HyperLink hypDetail = new HyperLink(); hypDetail.Text = "<h4><i class='fa fa-lock'></i></h4>"; hypDetail.NavigateUrl = urlDetail; hypDetail.ToolTip = "Detail"; hypDetail.Target = "_Blank"; cellDetail.Controls.Add(hypDetail); } } tRowBody.Cells.Add(cellDetail); tb1.Rows.Add(tRowBody); num++; } TableRow row = new TableRow(); TableCell cell = new TableCell(); cell.Controls.Add(tb1); row.Cells.Add(cell); tblWorkLoad.Rows.Add(row); /*=============================*/ } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
protected void btnSEARCH_Click(object sender, EventArgs e) { SysUser lecturerALL = new SysUser(); lecturerALL = new SysUser().getSysUser(txtLecturerID.Text); int num = 1; if (lecturerALL.IdCode != null) { divShow.Visible = true; } else { divShow.Visible = false; } // Head Table string[] ar = { "ลำดับ", "ชื่ออาจารย์", "ตำแหน่ง", "ชั่วโมงสอนอ้างอิง", "หน่วยกิตรวม", "ภาระงานสอน ชั่วโมง/หน่วยกิต", "เพิ่ม", "แก้ไข", "ลบ" }; Table tb1 = new Table(); tb1.Attributes.Add("class", "table table-bordered table-striped table-hover"); tb1.Attributes.Add("id", "dt_basic"); TableHeaderRow tRowHead = new TableHeaderRow(); tRowHead.TableSection = TableRowSection.TableHeader; for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++) { TableHeaderCell cellHead = new TableHeaderCell(); cellHead.Text = ar[cellCtr - 1]; cellHead.Attributes.Add("class", "text-center"); tRowHead.Cells.Add(cellHead); } tb1.Rows.Add(tRowHead); TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; TableCell cellNum = new TableCell(); cellNum.Attributes.Add("class", "text-center"); cellNum.Text = num.ToString(); tRowBody.Cells.Add(cellNum); TableCell cellName = new TableCell(); cellName.Text = new AcademicPosition().getAcademicPosition(lecturerALL.AcademicPositionCode).AcademicPositionThName + " " + lecturerALL.ThName + " " + lecturerALL.ThSurName; tRowBody.Cells.Add(cellName); TableCell cellPosition = new TableCell(); cellPosition.Attributes.Add("class", "text-center"); cellPosition.Text = new BoardPos().getBoardPos(lecturerALL.Position).Position_Thai; tRowBody.Cells.Add(cellPosition); TableCell cellHourRef = new TableCell(); cellHourRef.Attributes.Add("class", "text-center"); cellHourRef.Text = new WorkLoadCalculate().getHourRef(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lecturerALL.IdCode).ToString(); tRowBody.Cells.Add(cellHourRef); TableCell cellTotalCredit = new TableCell(); cellTotalCredit.Attributes.Add("class", "text-center"); cellTotalCredit.Text = new WorkLoadCalculate().getTotalCredit(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lecturerALL.IdCode).ToString(); tRowBody.Cells.Add(cellTotalCredit); Sysuser2 user2 = new Sysuser2(); user2 = new Sysuser2().getSysuser2(lecturerALL.IdCode); WorkLoadConfigData workload = new WorkLoadConfigData(); workload = new WorkLoadConfig().getWorkLoadConfig(user2.Lecturer_Type, lecturerALL.Position); TableCell cellLoad = new TableCell(); cellLoad.Attributes.Add("class", "text-center"); cellLoad.Text = workload.HourReference.ToString() + " / " + workload.TotalCredit.ToString(); tRowBody.Cells.Add(cellLoad); string urlAdd = "AddWorkLoad.aspx?lecturer=" + lecturerALL.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue; HyperLink hypAdd = new HyperLink(); hypAdd.Text = "<h4><i class='fa fa-book'></i></h4>"; hypAdd.Attributes.Add("data-target", "#modal001"); hypAdd.Attributes.Add("data-toggle", "modal"); hypAdd.NavigateUrl = urlAdd; hypAdd.ToolTip = "Add"; hypAdd.Target = "_Blank"; TableCell cellAdd = new TableCell(); cellAdd.Width = 100; cellAdd.Attributes.Add("class", "text-center"); cellAdd.Controls.Add(hypAdd); tRowBody.Cells.Add(cellAdd); float add_ref = new AddWorkLoad().getAddWorkLoad(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lecturerALL.IdCode).HourRefer; float add_credit = new AddWorkLoad().getAddWorkLoad(txtACADEMIC_YEAR.Text, ddlSEMESTER.SelectedValue, lecturerALL.IdCode).HourRefer; string urlUpdate = "#"; string urlDelete = "#"; HyperLink hypUpdate = new HyperLink(); HyperLink hypDelete = new HyperLink(); if (add_credit + add_ref == 0) { hypUpdate.Text = "<h4><i class='fa fa-ban'></i></h4>"; hypUpdate.Attributes.Add("data-target", "#modal001"); hypUpdate.ToolTip = "Update"; hypUpdate.Target = "_Blank"; hypDelete.Text = "<h4><i class='fa fa-ban'></i></h4>"; hypDelete.ToolTip = "Delete"; hypDelete.Target = "_Blank"; } else { urlUpdate = "EditWorkLoad.aspx?lecturer=" + lecturerALL.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue; urlDelete = "delAddWorkLoad.aspx?lecturer=" + lecturerALL.IdCode + "&year=" + txtACADEMIC_YEAR.Text + "&semester=" + ddlSEMESTER.SelectedValue; hypUpdate.Text = "<h4><i class='fa fa-edit'></i></h4>"; hypUpdate.Attributes.Add("data-target", "#modal001"); hypUpdate.Attributes.Add("data-toggle", "modal"); hypUpdate.NavigateUrl = urlUpdate; hypUpdate.ToolTip = "Update"; hypUpdate.Target = "_Blank"; hypDelete.Text = "<h4><i class='fa fa-trash-o'></i></h4>"; hypDelete.Attributes.Add("data-target", "#modal001"); hypDelete.Attributes.Add("data-toggle", "modal"); hypDelete.NavigateUrl = urlDelete; hypDelete.ToolTip = "Delete"; hypDelete.Target = "_Blank"; } TableCell cellUpdate = new TableCell(); cellUpdate.Width = 100; cellUpdate.Attributes.Add("class", "text-center"); cellUpdate.Controls.Add(hypUpdate); tRowBody.Cells.Add(cellUpdate); TableCell cellDelete = new TableCell(); cellDelete.Width = 100; cellDelete.Attributes.Add("class", "text-center"); cellDelete.Controls.Add(hypDelete); tRowBody.Cells.Add(cellDelete); tb1.Rows.Add(tRowBody); num++; TableRow row = new TableRow(); TableCell cell = new TableCell(); cell.Controls.Add(tb1); row.Cells.Add(cell); tblWorkLoad.Rows.Add(row); }