protected void grdTeamMembers_RowDataBound(object sender, GridViewRowEventArgs e) { // Edit items if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate)))) { int costingSheetId = Int32.Parse(((Label)e.Row.FindControl("lblCostingSheetIDEdit")).Text.Trim()); int employeeId = Int32.Parse(((Label)e.Row.FindControl("lblEmployeeIDEdit")).Text.Trim()); int refId = Int32.Parse(((Label)e.Row.FindControl("lblRefIDEdit")).Text.Trim()); string work_ = ((Label)e.Row.FindControl("lblWork_Edit")).Text.Trim(); ProjectCombinedCostingSheetInformationLabourHoursInformationGateway projectCostingSheetInformationLabourHoursInformationGateway = new ProjectCombinedCostingSheetInformationLabourHoursInformationGateway(projectCostingSheetInformationTDS); string unitOfMeasurement = projectCostingSheetInformationLabourHoursInformationGateway.GetLHUnitOfMeasurement(costingSheetId, work_, employeeId, refId); ((DropDownList)e.Row.FindControl("ddlUnitOfMeasurementLHEdit")).SelectedValue = unitOfMeasurement; string unitOfMeasurementMeals = projectCostingSheetInformationLabourHoursInformationGateway.GetMealsUnitOfMeasurement(costingSheetId, work_, employeeId, refId); ((DropDownList)e.Row.FindControl("ddlUnitsOfMeasurementLHMealsEdit")).SelectedValue = unitOfMeasurementMeals; string unitOfMeasurementMotel = projectCostingSheetInformationLabourHoursInformationGateway.GetMotelUnitOfMeasurement(costingSheetId, work_, employeeId, refId); ((DropDownList)e.Row.FindControl("ddlUnitsOfMeasurementLHMotelEdit")).SelectedValue = unitOfMeasurementMotel; bool inDatabase = projectCostingSheetInformationLabourHoursInformationGateway.GetInDatabase(costingSheetId, work_, employeeId, refId); if (inDatabase) { ((RadDatePicker)e.Row.FindControl("tkrdpEndDateEdit")).Calendar.Enabled = false; ((RadDatePicker)e.Row.FindControl("tkrdpEndDateEdit")).DateInput.ReadOnly = true; ((RadDatePicker)e.Row.FindControl("tkrdpStartDateEdit")).Calendar.Enabled = false; ((RadDatePicker)e.Row.FindControl("tkrdpStartDateEdit")).DateInput.ReadOnly = true; } ((RadDatePicker)e.Row.FindControl("hdfFrom")).SelectedDate = Convert.ToDateTime(hdfFromDate.Value); ((RadDatePicker)e.Row.FindControl("hdfTo")).SelectedDate = Convert.ToDateTime(hdfToDate.Value); } // Footer Item if (e.Row.RowType == DataControlRowType.Footer) { ((RadDatePicker)e.Row.FindControl("hdfFrom")).SelectedDate = Convert.ToDateTime(hdfFromDate.Value); ((RadDatePicker)e.Row.FindControl("hdfTo")).SelectedDate = Convert.ToDateTime(hdfToDate.Value); } }