Пример #1
0
        protected void lisAdditionalInformation_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            //
            // When a item come to the reader, it automatically searchs the AdditionalInformationData
            // to fill the ComboBox with the related value.
            //
            DropDownList          cboOrg   = e.Item.Controls[5] as DropDownList;
            HumanResourcesManager hManager = new HumanResourcesManager(this);

            cboOrg.DataSource     = hManager.GetAdditionalInformationData(Company.CompanyId, Convert.ToInt32((e.Item.Controls[1] as Label).Text));
            cboOrg.DataTextField  = "Name";
            cboOrg.DataValueField = "AddonInfoDataId";
            cboOrg.DataBind();
            //
            // If the form are in the update mode, the combobox will bind to the correct value, automatically
            //
            if (employeeId != null)
            {
                EmployeeAdditionalInformation addInfo = hManager.GetEmployeeAdditionalInformation
                                                        (
                    Company.CompanyId,
                    Convert.ToInt32((e.Item.Controls[1] as Label).Text),
                    employeeId
                                                        );
                if (addInfo != null)
                {
                    cboOrg.SelectedValue = addInfo.AddonInfoDataId.ToString();
                }
            }
        }
 protected void lisAdditionalInformation_ItemDataBound(object sender, DataListItemEventArgs e)
 {
     //
     // When a item come to the reader, it automatically searchs the AdditionalInformationData
     // to fill the ComboBox with the related value.
     //
     DropDownList cboOrg = e.Item.Controls[5] as DropDownList;
     HumanResourcesManager hManager = new HumanResourcesManager(this);
     cboOrg.DataSource = hManager.GetAdditionalInformationData(Company.CompanyId, Convert.ToInt32((e.Item.Controls[1] as Label).Text));
     cboOrg.DataTextField = "Name";
     cboOrg.DataValueField = "AddonInfoDataId";
     cboOrg.DataBind();
     //
     // If the form are in the update mode, the combobox will bind to the correct value, automatically
     //
     if (employeeId != null)
     {
         EmployeeAdditionalInformation addInfo = hManager.GetEmployeeAdditionalInformation
             (
             Company.CompanyId,
             Convert.ToInt32((e.Item.Controls[1] as Label).Text),
             employeeId
             );
         if (addInfo != null)
             cboOrg.SelectedValue = addInfo.AddonInfoDataId.ToString();
     }
 }