protected void btnUpate_Click(object sender, EventArgs e)
 {
     int id = int.Parse(hfDeptPersonId.Value);
     if (isValid(id))
     {
         DepartmentHazard.DepartmentHazardSelectCommandRow dataRow = getDepartmentPerson(id);
         if (dataRow != null)
         {
             DepartmentHazardTableAdapters.DepartmentHazardSelectCommandTableAdapter tableAdapter = new DepartmentHazardTableAdapters.DepartmentHazardSelectCommandTableAdapter();
             tableAdapter.Update(int.Parse(ddlDepartment.SelectedValue), tbName.Text, dataRow.index_seq, loggedInUserId, dataRow.sequence, int.Parse(ddlCategory.SelectedValue),cbDefault.Checked);
             repeater.DataBind();
             SetInfoMessage(WebConstants.Messages.Information.RECORD_SAVED);
         }
         btnAdd.Visible = true;
         btnUpate.Visible = false;
         tbName.Text = "";
     }
 }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string[] idList = Request["idOrdering"].Split(',');
     if (idList != null)
     {
         //-i because we have an extra comma at the end
         for (int i = 0; i < idList.Length - 1; i++)
         {
             DepartmentHazard.DepartmentHazardSelectCommandRow dataRow = getDepartmentPerson(int.Parse(idList[i]));
             if (dataRow != null)
             {
                 DepartmentHazardTableAdapters.DepartmentHazardSelectCommandTableAdapter tableAdapter = new DepartmentHazardTableAdapters.DepartmentHazardSelectCommandTableAdapter();
                 tableAdapter.Update(dataRow.dept_id, dataRow.name_desc, i + 1, loggedInUserId, dataRow.sequence, dataRow.category_id,dataRow.flg_default);
             }
         }
     }
     SetInfoMessage(WebConstants.Messages.Information.RECORD_SAVED);
     repeater.DataBind();
 }