Ticket Q510279
Visible to All Users
Duplicate

ASPxLookupPropertyEditor Tabstop

created 12 years ago

We have a C# web application.

I am trying to have the tab skip over a look up property on a detail view in edit mode. Years ago one of our developers submitted the following support ticket- http://www.devexpress.com/Support/Center/Question/Details/Q208313. While a similar solution appears to work with other property editor types, it does not appear to work with look up property editors anymore. Could you please advise how to do this in more recent versions of XAF? I have provided a snippet of the code we are currently trying to use to implement this functionality below.

C#
protected override void SetupControl(WebControl control) { base.SetupControl(control); if (ViewEditMode == ViewEditMode.Edit) { ASPxLookupDropDownEdit aspxDropDown = control as ASPxLookupDropDownEdit; if (aspxDropDown != null) { // Turn off tab stop ASPxComboBox aspxCombo = aspxDropDown.DropDown; aspxCombo.TabIndex = -1; } } }

Thank you
Randy

Comments (1)
Dennis Garavsky (DevExpress) 12 years ago

    Hello Randy,
    I tested this code with the latest version, but it also did not work in my tests. Give me some time to research the cause of this behavior. Your patience is highly appreciated.

    Answers approved by DevExpress Support

    created 12 years ago (modified 12 years ago)

    I apologize, as there was a misprint in my code and the previous code should work fine with the latest version:

    C#
    using System; using System.ComponentModel; using System.Collections.Generic; using System.Diagnostics; using System.Text; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Actions; using DevExpress.Persistent.Base; using DevExpress.ExpressApp.Web.Editors; using DevExpress.Web.ASPxEditors; using System.Web.UI.WebControls; using DevExpress.ExpressApp.Utils; using DevExpress.ExpressApp.Web.Editors.ASPx; namespace MainDemo.Module.Web.Controllers { public partial class WebNullTextEditorController : ViewController { public WebNullTextEditorController() { InitializeComponent(); RegisterActions(components); } private void InitNullText(ASPxLookupPropertyEditor propertyEditor) { if(propertyEditor.ViewEditMode == DevExpress.ExpressApp.Editors.ViewEditMode.Edit) { if(propertyEditor.FindEdit != null) { propertyEditor.FindEdit.TabIndex = -1; propertyEditor.FindEdit.TextBox.TabIndex = -1; } if (propertyEditor.DropDownEdit!=null){ propertyEditor.DropDownEdit.TabIndex = -1; propertyEditor.DropDownEdit.DropDown.TabIndex = -1; } } } private void WebNullTextEditorController_Activated(object sender, EventArgs e) { ASPxLookupPropertyEditor propertyEditor = ((DetailView)View).FindItem("Manager") as ASPxLookupPropertyEditor; if(propertyEditor != null) { if(propertyEditor.Control != null) { InitNullText(propertyEditor); } else { propertyEditor.ControlCreated += new EventHandler<EventArgs>(propertyEditor_ControlCreated); } } } private void propertyEditor_ControlCreated(object sender, EventArgs e) { InitNullText((ASPxLookupPropertyEditor)sender); } } }

    In the next XAF version you will be able to write less code for this scenario:

    C#
    if(propertyEditor.FindEdit != null) { propertyEditor.FindEdit.TabIndex = -1; } if (propertyEditor.DropDownEdit!=null){ propertyEditor.DropDownEdit.TabIndex = -1; }

    and this will also affect the TabIndex property of the Clear, New and Find buttons of the editor.

      Comments (3)

        Works great! Thank you for your help Dennis.
        -Randy

        Dennis Garavsky (DevExpress) 12 years ago

          You are always welcome!

          Dennis Garavsky (DevExpress) 10 years ago

            Hi Randy,

            Starting with v15.1 you can remove this customization code completely, because the ASPxLookupDropDownEdit class was refactored to avoid the original problem by default. Instead of inheriting the standard Table class and adding separate button controls into table cells, we now leverage the built-in functionality of the ASPxComboBox buttons.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.