Print Page | Close Window

How to remove "X" button from lookup field on the grid

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=819
Printed Date: 11-Jun-2026 at 3:07am


Topic: How to remove "X" button from lookup field on the grid
Posted By: vkuzmich
Subject: How to remove "X" button from lookup field on the grid
Date Posted: 29-May-2008 at 7:48am
Hi,
 
I am using DevExpress GridControl and IdeaBlade XtraGridBindingManager.  And I am getting "X" button on lookup columns. Please see picture. I put there an example from IdeaBlade documentation and screenshot from my app.
http://www.ideablade.com/forum/uploads/20080529_104641_X_Button.rar - uploads/20080529_104641_X_Button.rar
 
Thanks for your help.
 
VK



Replies:
Posted By: davidklitzke
Date Posted: 29-May-2008 at 10:45am

 There is a property on the LookupEdit called “AllowNullInput” which if set to “False” is supposed to prevent entering  null input, but it doesn’t seem to work.  Looking further, I see other posts on the Devex Forums from others who also claim that the “AllowNullIInput” property does not work,

 



Posted By: vkuzmich
Date Posted: 29-May-2008 at 11:23am
Thank you. It is good to know.
 
When you have IdeaBlade XtraGridBindingManager for your grid and have LookUp (inside of XtraGridBindingManager ) there for one of the fields, you don't see this property "AllowNullInput".
 
 
Maybe I can access somehow this property in run-time? I have tried, but did not succeed.
 
 
VK


Posted By: davidklitzke
Date Posted: 29-May-2008 at 11:33am
VK,
 
The property is there.  it just doesn't work.  You have to look at the lookupedit.properties.
 


Posted By: vkuzmich
Date Posted: 29-May-2008 at 11:46am

I think we are really talking about different things. Please take a look at this screen shot.

http://www.ideablade.com/forum/uploads/temp/20080529_144447_X_Button2.rar - uploads/temp/20080529_144447_X_Button2.rar

VK



Posted By: davidklitzke
Date Posted: 31-May-2008 at 9:38am
A DevForce customer told me that he had obtained this from DevExpress support team:
 

To hide the LookUpEdit popup footer (which holds the close button), set the LookUpEdit.Properties.ShowFooter property to False.
To hide only the Close button, create a custom editor inherited from the LookUpEdit. Override the LookUpEdit.CreatePopupForm method to return a custom PopupLookUpEditForm descendant. Override the PopupLookUpEditForm.SetupButtons method, and after the base method call, set the fCloseButtonStyle property to BlobCloseButtonStyle.None.

[C#]

    public class MyLookUpEdit : LookUpEdit
    {
        //...

        protected override PopupBaseForm CreatePopupForm()
        {
            return new MyPopupLookUpEditForm(this);
        }
    }

    public class MyPopupLookUpEditForm : PopupLookUpEditForm
    {
        //...

        protected override void SetupButtons()
        {
            base.SetupButtons();
            this.fCloseButtonStyle = BlobCloseButtonStyle.None;
        }
    }

We suggest that you refer to the http://www.devexpress.com/Help/?document=XtraEditors/CustomDocument1291.htm - Custom Editors help topic.

Please let us know if this makes sense.



Posted By: erturkcevik
Date Posted: 31-May-2008 at 11:21am
This isue solulation as the following :
 

'X' button = assign null value button in the Loookupeditor Display with DrowDown button alongside

 
- First Devforce may be adding feature enable or disable for 'X' button in the DevExpress Lookupedit of ListConverter
 
- Second Adding custom databinder with "LookupEditDataBinder"  file (provided for Devforce)
 
As far as I see, you should comment out the following lines in the LookupEditDataBinder :

[C#]

      if ((listConverter.Editability == Editability.Optional) && !ContainsDeleteButton(properties.Buttons)) {
          properties.Buttons.Insert(0, new EditorButton(ButtonPredefines.Delete));
          properties.ActionButtonIndex = 1;
          properties.ButtonPressed += new ButtonPressedEventHandler(ButtonPressedHandler);
        }

Alternatively, set the (ViewDescriptor.DataConverter as ListConverter).Editability property to a value other than Editability.Optional.

 
Best Regards
 
 


Posted By: vkuzmich
Date Posted: 02-Jun-2008 at 10:57am
Thank you http://www.ideablade.com/forum/member_profile.asp?PF=45&FID=14 - erturkcevik .
 
This code worked for me:
 

DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit lookup = (DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit)colShowIAB.RealColumnEdit;

foreach (DevExpress.XtraEditors.Controls.EditorButton button in lookup.Buttons)

{

    if (button.Kind == ButtonPredefines.Delete)

    {

        button.Visible = false;

    }

}

 
VK



Print Page | Close Window