Code
protected void OnRowDataBound(object sender, GridViewRowEventArgs e)Code
{Code
if (e.Row.RowType == DataControlRowType.DataRow)Code
{Code
CheckBox CHKBOX = (e.Row.FindControl("Released") as CheckBox);Code
CheckBox CHKBOX1 = (e.Row.FindControl("Released1") as CheckBox);Code
DropDownList ddlEmployee = (e.Row.FindControl("ddlEmp") as DropDownList);Code
DropDownList ddlEmployee2 = (e.Row.FindControl("ddlEmp2") as DropDownList);Code
var emp1 = _service.GetEmployeeDutyByEmployee_Id(MyUser.Employee_Id).LastOrDefault();Code
var EmpList = _service.GetAllEmployeeDuty().OrderByDescending(x => x.EndDate).GroupBy(x => x.Employee_Id).Select(x => x.First()).ToList();Code
var empList = EmpList.Where(X => X.ToSector_Id == emp1.ToSector_Id).ToList();Code
ddlEmployee.Bind(empList, "EmployeeIdName", "Employee_Id");Code
ddlEmployee2.Bind(empList, "EmployeeIdName", "Employee_Id");Code
}Code
}and use following code to save the values
Hide Copy Code
Code
protected void ddlEmp_SelectedIndexChanged(object sender, EventArgs e)Code
{Code
Entities entities = new Entities();Code
Control row = ((Control)sender).NamingContainer;Code
DropDownList ddlEmp = (DropDownList)row.FindControl("ddlEmp");Code
DropDownList ddlEmp2 = (DropDownList)row.FindControl("ddlEmp2");Code
Label lblPointName = (Label)ddlEmp.NamingContainer.FindControl("lblPointName");Code
Label lblPointName1 = (Label)ddlEmp.NamingContainer.FindControl("lblPointName1");Code
string Emp1 = ddlEmp.SelectedValue;Code
string Emp2 = ddlEmp2.SelectedValue;Code
string pointname = lblPointName.Text;Code
string pointname1 = lblPointName1.Text;Code
var PointIdByName = (from mdp in entities.SectorWisePoints.Where(x => x.Name == pointname) select mdp).Single();Code
var EmployeeById = (from ebi in entities.ModifiedNames.Where(x => x.BeltNo == Emp1) select ebi).Single();Code
CTP.HRMS.Business.DailyManualRoaster dmr = new Business.DailyManualRoaster();Code
dmr.SectorWisePoint_Id = PointIdByName.Id;Code
dmr.Employee_Id = EmployeeById.BeltNo;Code
dmr.ManDailyRoasterDate = DateTime.Now;Code
dmr.Sector_Id = 1;Code
_service.InsertDailyManualRoaster(dmr); }2.i have a checkbox along each row when user click on this box the employee against
this row that is save already ,will be deleted from database and again add to list of dropdown?


Answers
Know the answer? Post it. Somebody with the same question will find it here.