private ASPxSearchDropDownEdit CreateSearchDropDownEditControl()
        {
            ASPxSearchDropDownEdit result = new ASPxSearchDropDownEdit(helper, EmptyValue, DisplayFormat);

            result.Width = Unit.Percentage(100);
            result.DropDown.SelectedIndexChanged += new EventHandler(dropDownLookup_SelectedIndexChanged);
            result.Init      += new EventHandler(dropDownLookup_Init);
            result.PreRender += new EventHandler(dropDownLookup_PreRender);
            result.Callback  += new EventHandler <CallbackEventArgs>(result_Callback);
            result.ReadOnly   = !AllowEdit;
            UpdateDropDownLookup(result);
            return(result);
        }
 public override void BreakLinksToControl(bool unwireEventsOnly)
 {
     if (searchDropDownEdit != null)
     {
         searchDropDownEdit.DropDown.SelectedIndexChanged -= new EventHandler(dropDownLookup_SelectedIndexChanged);
         searchDropDownEdit.Init      -= new EventHandler(dropDownLookup_Init);
         searchDropDownEdit.PreRender -= new EventHandler(dropDownLookup_PreRender);
         searchDropDownEdit.Callback  -= new EventHandler <CallbackEventArgs>(result_Callback);
     }
     if (!unwireEventsOnly)
     {
         searchDropDownEdit = null;
     }
     base.BreakLinksToControl(unwireEventsOnly);
 }
        protected override WebControl CreateEditModeControlCore()
        {
            if (newObjectWindowAction == null)
            {
                newObjectWindowAction          = new PopupWindowShowAction(null, "New", PredefinedCategory.Unspecified.ToString());
                newObjectWindowAction.Execute += new PopupWindowShowActionExecuteEventHandler(newObjectWindowAction_OnExecute);
                newObjectWindowAction.CustomizePopupWindowParams += new CustomizePopupWindowParamsEventHandler(newObjectWindowAction_OnCustomizePopupWindowParams);
                newObjectWindowAction.Application = helper.Application;
            }

            Panel panel = new Panel(); // Use Panel instead of ASPxPanel cause it doesn't affect editor ClientID

            searchDropDownEdit = CreateSearchDropDownEditControl();
            panel.Controls.Add(searchDropDownEdit);
            return(panel);
        }
        private void UpdateDropDownLookup(WebControl editor)
        {
            ASPxSearchDropDownEdit supportNewObjectCreating = editor as ASPxSearchDropDownEdit;

            if (supportNewObjectCreating != null)
            {
                if (newObjectViewController != null)
                {
                    supportNewObjectCreating.NewActionCaption = newObjectViewController.NewObjectAction.Caption;
                }
                UpdateDropDownLookupControlAddButton(supportNewObjectCreating);
                if (application != null)
                {
                    supportNewObjectCreating.SetClientNewButtonScript(application.PopupWindowManager.GenerateModalOpeningScript(editor, newObjectWindowAction, WindowWidth, WindowHeight, false, supportNewObjectCreating.GetProcessNewObjFunction()));
                }
            }
        }
 private void UpdateDropDownLookupControlAddButton(ASPxSearchDropDownEdit control)
 {
     control.AddingEnabled = false;
     if (CurrentObject != null)
     {
         string diagnosticInfo = "";
         RecreateListView(true);
         control.AddingEnabled = AllowEdit && DataManipulationRight.CanCreate(listView, helper.LookupObjectType, listView.CollectionSource, out diagnosticInfo);
         if (control.AddingEnabled)
         {
             if (newObjectViewController != null)
             {
                 control.AddingEnabled = newObjectViewController.NewObjectAction.Active && newObjectViewController.NewObjectAction.Enabled;
             }
         }
     }
 }