Why I Love Local Initializers...

  1. layoutTable.Rows.Add
  2. (
  3. ControlUtils.CreateRow
  4. (
  5. EmployeeFieldLabels.ExternalCompanyName,
  6. new ExtCompanyPickerControl(CreateChildID("ExternalCompanyName"))
  7. {
  8. Customizer = new ExtCompanyCustomizer(MedaSession),
  9. AllowMultipleSelection = false,
  10. RenderListHeader = false,
  11. CountryProviderId = locationPickerControl.ID,
  12. CountryProviderProperty = "SelectedCountryIsoCode";
  13. },
  14. false,
  15. EmployeeFieldTooltips.ExternalCompanyName,
  16. Page,
  17. CreateChildID("ExternalCompanyLabel"),
  18. (
  19. externalCompanyValidator = new CompareValidator
  20. {
  21. ControlToValidate = CreateChildID("ExternalCompanyName"),
  22. Operator = ValidationCompareOperator.Equal,
  23. Type = ValidationDataType.Integer,
  24. ValueToCompare = "1",
  25. EnableClientScript = false,
  26. Display = ValidatorDisplay.Dynamic,
  27. ErrorMessage = string.Format(EmployeeManagerControlRes.ErrorValueRequired, EmployeeFieldLabels.ExternalCompanyName)
  28. }
  29. )
  30. )
  31. );

Check them out! http://msdn.microsoft.com/en-us/library/bb384062.aspx