public void ExecuteCommand()
        {
            log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            try
            {
                if (Command != null)
                {
                    Me = (DefaultOrPopulateScreenCommand)Command;
                }


                bool CanExecute = Me.ExecuteOnPostBack ? true : (!Page.IsPostBack);


                if (CanExecute)
                {
                    if (!String.IsNullOrEmpty(Me.EntityID))
                    {
                        PageMode = Page.DetermineMode(Me.EntityID, Me.EntityInputType);

                        if (PageMode == FormViewMode.Insert)
                        {
                            DefaultForm();
                        }
                        else
                        {
                            PopulateForm();
                        }
                    }
                    else
                    {
                        if (!String.IsNullOrEmpty(Me.DefaultCommand))
                        {
                            DefaultForm();
                        }

                        if (!String.IsNullOrEmpty(Me.RetrieveCommand))
                        {
                            PopulateForm();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Page.DisplayErrorAlert(ex);

                log.Error(ex);
            }
        }
        private static StandardValuesCollection GetDataFieldColumns(ITypeDescriptorContext context, StandardValuesCollection list)
        {
            Widget control = (Widget)context.Instance;

            if ((control.Parent != null) && (control.Parent is Section))
            {
                Section section = (Section)control.Parent;

                if ((section.Parent != null) && (section.Parent is Screen))
                {
                    Screen screen = (Screen)section.Parent;

                    ActionCommand actionComand = screen.OnPageLoad.Commands.Where(c => c.Type.ToLower() == "defaultorpopulatescreencommand").SingleOrDefault();
                    if ((actionComand != null) && (actionComand is DefaultOrPopulateScreenCommand))
                    {
                        DefaultOrPopulateScreenCommand defaultCommand = (DefaultOrPopulateScreenCommand)actionComand;

                        string DataCommandName = null;
                        if (!String.IsNullOrEmpty(defaultCommand.RetrieveCommand))
                        {
                            DataCommandName = defaultCommand.RetrieveCommand;
                        }
                        else
                        {
                            if (!String.IsNullOrEmpty(defaultCommand.DefaultCommand))
                            {
                                DataCommandName = defaultCommand.DefaultCommand;
                            }
                        }

                        if (!String.IsNullOrEmpty(DataCommandName))
                        {
                            var retVal = from item in Configuration.GetInstance().DataCommands
                                         from column in item.Columns
                                         where item.Name.ToLower() == DataCommandName.ToLower()
                                         select column.Name;

                            string[] items = retVal.ToArray <string>();
                            list = new StandardValuesCollection(items);
                        }
                    }
                }
            }
            return(list);
        }