in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

Hide a lookupedit column ?

Last post 7/1/2008 7:46 PM by Ferret. 2 replies.
Page 1 of 1 (3 items)
Sort Posts:
Previous Next
  • 10/29/2007 9:54 AM

    Hide a lookupedit column ?

    i'm trying to hide the first column ("id") of a lookupedit after I load the coresponding dataset.

               lCapitol.Properties.DataSource = nContabDataSet.Tables["capitol"];
               lCapitol.Properties.Columns[0].Visible = false;       //also tried            lCapitol.Properties.Columns["id"].Visible = false;
               lCapitol.Properties.DisplayMember = "Cod";
               lCapitol.Properties.ValueMember = "id";
               

     at the second line i get the following error:

    Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index 

    OR     Object reference not set to an instance of an object.  when when using ["id"].

     


    Filed under: , ,
  • 10/29/2007 10:42 AM In reply to

    Re: Hide a lookupedit column ?

    Hello,

    Gigi gigi:
    i get the following error:

    Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index 

    OR     Object reference not set to an instance of an object.  when when using ["id"].

    As long as you are not explicitly populating the LookupEdit's Columns collection there will be no columns available - the LookupEdit's auto populating mechanism doesn't add columns to the Columns collection, thus you are running into an exception when accessing the collection. 

    Instead of hiding the "id" column I would like to suggest to add all the other columns to the Columns collection:

        this.lookupEdit1.Properties.Columns.Add(new LookUpColumnInfo("Cod", 50, "Cod"));
        this.lookupEdit1.Properties.Columns.Add(new LookUpColumnInfo(...);

    Hope this helps,
    Holger

    Holger Persch - [DX-Squad]
  • 7/1/2008 7:46 PM In reply to

    • Ferret
    • Not Ranked
    • Joined on 4/17/2008
    • Sydney, Australia
    • Posts 3

    Re: Hide a lookupedit column ?

    I had the same problem and your solution helps a great deal, thankyou!

    http://myspace.com/ferretallica
    http://ferretallica.deviantart.com
    http://last.fm/user/ferretallica
Page 1 of 1 (3 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED