In my ASP.NET solution, I extended IModelMember with a property that hides the Add New button on lookup property editors. This worked in DevExpress 17.1, but it does not work in 18.2, because the Frame property in the controller below is now always null. Is there another way to get to that object?
If you use DevExpress 17.1 with the attached sample project, it should work, but if you use 18.2, it won't work.
C#public class MemberExtensionsController : ViewController<DetailView>
{
protected override void OnActivated()
{
base.OnActivated();
foreach (var editor in View.Items.OfType<ASPxLookupPropertyEditor>())
{
if (!((ICustomMemberExtension)editor.Model.ModelMember).LookupAllowAdd)
editor.ControlCreated += LookupPropertyEditor_ControlCreated_DisableAllowNew;
}
}
private void LookupPropertyEditor_ControlCreated_DisableAllowNew(object sender, EventArgs e)
{
var frame = ((ASPxLookupPropertyEditor)sender).Frame;
if (frame != null)
{
var controller = frame.GetController<NewObjectViewController>();
if (controller != null)
controller.NewObjectAction.Active.SetItemValue("Lookup_AllowNew", false);
}
}
}
Hello,
Please give us additional time to research your project. We will notify you once we have any news.
Thanks,
Andrey