s.no pointsName Employee IsOK
1 XXX(TEXTBOX) EMP1(DDL) TRUE(CHECKBOX)
2 YYY(TEXTBOX) EMP1(DDL) TRUE(CHECKBOX
3 zzz(TEXTBOX) EMP1(DDL) TRUE(CHECKBOX
Id Name
1 xxx
2 yyy
3 zzz
DataTable dt = new DataTable();
DataRow dr = null;
var SecPoint = _service.GetAllDutyPoint().ToList();
foreach (var point in SecPoint)
{ for (int I = 1; I <= point.NoOfMinEmployes; I++)
{ ////Define the Columns
//dr["RowNumber"] = I + 1;
//dt.Columns.Add(new DataColumn("RowNumber", typeof(string)));
//dt.Columns.Add(new DataColumn("Column1", typeof(string)));
//dt.Columns.Add(new DataColumn("Column2", typeof(string)));
//dt.Columns.Add(new DataColumn("Column3", typeof(string)));
//dr = dt.NewRow();
//dt.Rows.Add(dr);
////Store the DataTable in ViewState
//ViewState["CurrentTable"] = dt;
////Bind the DataTable to the Grid
//Gridview1.DataSource = dt;
//Gridview1.DataBind();
////Extract and Fill the DropDownList with Data
//TextBox txtbox = (TextBox)Gridview1.Rows[0].Cells[1].FindControl("TextBox12");
//DropDownList ddl1 = (DropDownList)Gridview1.Rows[0].Cells[2].FindControl("ddlEmp");
//TextBox txtbox1 = (TextBox)Gridview1.Rows[0].Cells[3].FindControl("TextBox13");
//DropDownList ddl2 = (DropDownList)Gridview1.Rows[0].Cells[4].FindControl("ddlEmp2");
//FillDropDownList(ddl1);
//FillDropDownList(ddl2); private void FillDropDownList(DropDownList ddl)
{ var emp1 = _service.GetEmployeeDutyByEmployee_Id(MyUser.Employee_Id).LastOrDefault();
var EmpList = _service.GetAllEmployeeDuty().OrderByDescending(x => x.EndDate).GroupBy(x => x.Employee_Id).Select(x => x.First()).ToList();
var empList = EmpList.Where(X=>X.ToSector_Id== emp1.ToSector_Id).ToList();
ddl.Bind(empList, "EmployeeIdName", "Employee_Id");
}