//人員切換之後指定EmpID protected void RadioButton1_CheckedChanged(object sender, EventArgs e) { RadioButton RadioButton1 = sender as RadioButton; RadioButton1.Checked = true; GridView_RegisterPeoplinfo.SelectedIndex = (RadioButton1.NamingContainer as GridViewRow).RowIndex; EmpID = GridView_RegisterPeoplinfo.DataKeys[GridView_RegisterPeoplinfo.SelectedIndex].Value.ToString(); //載入個人資訊 //個人固定欄位 ObjectDataSource_fixA.SelectParameters["activity_id"].DefaultValue = ActivityID.ToString(); ObjectDataSource_fixA.SelectParameters["emp_id"].DefaultValue = EmpID; FormView_fixA.DataBind(); //載入動態欄位資料 ACMS.DAO.CustomFieldValueDAO myCustomFieldValueDAO = new ACMS.DAO.CustomFieldValueDAO(); List <ACMS.VO.CustomFieldValueVO> myCustomFieldValueVOList = myCustomFieldValueDAO.SelectCustomFieldValue(ActivityID, EmpID); foreach (ACMS.VO.CustomFieldValueVO myCustomFieldValueVO in myCustomFieldValueVOList) { if (myCustomFieldValueVO.field_control.ToUpper() == "TEXTBOX") { TextBox MyControl = new TextBox(); MyControl.ID = string.Format("txt{0}", myCustomFieldValueVO.field_id); (PlaceHolder1.FindControl(MyControl.ID) as TextBox).Text = myCustomFieldValueVO.field_value; } else if (myCustomFieldValueVO.field_control.ToUpper() == "TEXTBOXLIST") { TCheckBoxList MyControl = new TCheckBoxList(); MyControl.ID = string.Format("plh{0}", myCustomFieldValueVO.field_id); (PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList).SelectedValueList = myCustomFieldValueVO.field_value; CheckBoxList1_SelectedIndexChanged((PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList), null); } else if (myCustomFieldValueVO.field_control.ToUpper() == "CHECKBOXLIST") { TCheckBoxList MyControl = new TCheckBoxList(); MyControl.ID = string.Format("cbl{0}", myCustomFieldValueVO.field_id); (PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList).SelectedValueList = myCustomFieldValueVO.field_value; } else if (myCustomFieldValueVO.field_control.ToUpper() == "RADIOBUTTONLIST") { TRadioButtonList MyControl = new TRadioButtonList(); MyControl.ID = string.Format("radl{0}", myCustomFieldValueVO.field_id); (MyControl as TRadioButtonList).ClearSelection(); (PlaceHolder1.FindControl(MyControl.ID) as TRadioButtonList).SelectedValue = myCustomFieldValueVO.field_value; } } }
//編輯時載入自訂欄位資料 private void GetDynamicValue() { ACMS.DAO.CustomFieldValueDAO myCustomFieldValueDAO = new ACMS.DAO.CustomFieldValueDAO(); List<ACMS.VO.CustomFieldValueVO> myCustomFieldValueVOList = myCustomFieldValueDAO.SelectCustomFieldValue(ActivityID, RegistBy); foreach (ACMS.VO.CustomFieldValueVO myCustomFieldValueVO in myCustomFieldValueVOList) { Session["ShowPanel"] = true; if (myCustomFieldValueVO.field_control.ToUpper() == "TEXTBOX") { TextBox MyControl = new TextBox(); MyControl.ID = string.Format("txt{0}", myCustomFieldValueVO.field_id); try { (PlaceHolder1.FindControl(MyControl.ID) as TextBox).Text = myCustomFieldValueVO.field_value; } catch { InitQueryBlock(ActivityID.ToString()); (PlaceHolder1.FindControl(MyControl.ID) as TextBox).Text = myCustomFieldValueVO.field_value; } } else if (myCustomFieldValueVO.field_control.ToUpper() == "TEXTBOXLIST") { TCheckBoxList MyControl = new TCheckBoxList(); MyControl.ID = string.Format("plh{0}", myCustomFieldValueVO.field_id); try { (PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList).SelectedValueList = myCustomFieldValueVO.field_value; CheckBoxList1_SelectedIndexChanged((PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList), null); } catch { InitQueryBlock(ActivityID.ToString()); (PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList).SelectedValueList = myCustomFieldValueVO.field_value; CheckBoxList1_SelectedIndexChanged((PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList), null); } } else if (myCustomFieldValueVO.field_control.ToUpper() == "CHECKBOXLIST") { TCheckBoxList MyControl = new TCheckBoxList(); MyControl.ID = string.Format("cbl{0}", myCustomFieldValueVO.field_id); try { (PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList).SelectedValueList = myCustomFieldValueVO.field_value; } catch { InitQueryBlock(ActivityID.ToString()); (PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList).SelectedValueList = myCustomFieldValueVO.field_value; } } else if (myCustomFieldValueVO.field_control.ToUpper() == "RADIOBUTTONLIST") { TRadioButtonList MyControl = new TRadioButtonList(); MyControl.ID = string.Format("radl{0}", myCustomFieldValueVO.field_id); try { (MyControl as TRadioButtonList).ClearSelection(); (PlaceHolder1.FindControl(MyControl.ID) as TRadioButtonList).SelectedValue = myCustomFieldValueVO.field_value; } catch { InitQueryBlock(ActivityID.ToString()); (MyControl as TRadioButtonList).ClearSelection(); (PlaceHolder1.FindControl(MyControl.ID) as TRadioButtonList).SelectedValue = myCustomFieldValueVO.field_value; } } } }
//人員切換之後指定EmpID protected void RadioButton1_CheckedChanged(object sender, EventArgs e) { RadioButton RadioButton1 = sender as RadioButton; RadioButton1.Checked = true; GridView_RegisterPeoplinfo.SelectedIndex = (RadioButton1.NamingContainer as GridViewRow).RowIndex; EmpID = GridView_RegisterPeoplinfo.DataKeys[GridView_RegisterPeoplinfo.SelectedIndex].Value.ToString(); //載入個人資訊 //個人固定欄位 ObjectDataSource_fixA.SelectParameters["activity_id"].DefaultValue = ActivityID.ToString(); ObjectDataSource_fixA.SelectParameters["emp_id"].DefaultValue = EmpID; FormView_fixA.DataBind(); //載入動態欄位資料 ACMS.DAO.CustomFieldValueDAO myCustomFieldValueDAO = new ACMS.DAO.CustomFieldValueDAO(); List<ACMS.VO.CustomFieldValueVO> myCustomFieldValueVOList = myCustomFieldValueDAO.SelectCustomFieldValue(ActivityID, EmpID); foreach (ACMS.VO.CustomFieldValueVO myCustomFieldValueVO in myCustomFieldValueVOList) { if (myCustomFieldValueVO.field_control.ToUpper() == "TEXTBOX") { TextBox MyControl = new TextBox(); MyControl.ID = string.Format("txt{0}", myCustomFieldValueVO.field_id); (PlaceHolder1.FindControl(MyControl.ID) as TextBox).Text = myCustomFieldValueVO.field_value; } else if (myCustomFieldValueVO.field_control.ToUpper() == "TEXTBOXLIST") { TCheckBoxList MyControl = new TCheckBoxList(); MyControl.ID = string.Format("plh{0}", myCustomFieldValueVO.field_id); (PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList).SelectedValueList = myCustomFieldValueVO.field_value; CheckBoxList1_SelectedIndexChanged((PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList), null); } else if (myCustomFieldValueVO.field_control.ToUpper() == "CHECKBOXLIST") { TCheckBoxList MyControl = new TCheckBoxList(); MyControl.ID = string.Format("cbl{0}", myCustomFieldValueVO.field_id); (PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList).SelectedValueList = myCustomFieldValueVO.field_value; } else if (myCustomFieldValueVO.field_control.ToUpper() == "RADIOBUTTONLIST") { TRadioButtonList MyControl = new TRadioButtonList(); MyControl.ID = string.Format("radl{0}", myCustomFieldValueVO.field_id); (MyControl as TRadioButtonList).ClearSelection(); (PlaceHolder1.FindControl(MyControl.ID) as TRadioButtonList).SelectedValue = myCustomFieldValueVO.field_value; } } }