A way to hide first column?

10 posts, 0 answers
  1. ivan
    ivan avatar
    2 posts
    Member since:
    May 2008

    Posted 02 May 2008 Link to this post

    Hi,
    Is there a way to hide the first column in GridView? Or at least to change it to size 0-5?

    Thanks
  2. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 02 May 2008 Link to this post

    Hello ivan,

    Thank you for writing.

    You can hide the first column by retrieving it from the Columns collection and setting its Visible property to false, as shown below. You can index the Columns collection either by index, or by column unique name.

    this

    .radGridView1.Columns[0].IsVisible = false;
    this.radGridView1.Columns["Region"].IsVisible = false;

    The code above hides the first column, and the column with UniqueName with a value of "Region" from the RadGridView.

    Please keep in mind, that you have to make sure that the Columns collection has already been initialized, either by you manually in unbound mode, or automatically, due to databinding.

    If you have any additional questions, please contact me.

    All the best,
    Kiril
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
  4. ivan
    ivan avatar
    2 posts
    Member since:
    May 2008

    Posted 02 May 2008 Link to this post

    Thanks Kiril for the response, but I was not refering to *any* column in the grid, but the first one - the one that is not present in the list of columns. the first 20-30 pixel wide column.

    Ivan

  5. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 02 May 2008 Link to this post

    Hello ivan,

    Thank you for getting back to me.

    You can hide the row header column by setting the ShowHeaderRowColumn of the MasterGridViewTemplate to false. Note that this can also be any ViewTemplate object, if you have more than one in the same grid, as is the case in a hierarchical grid.

    There's also a minor change you have to make to the theme you're using:

    1. Open the Visual Style Builder, load the RadGridView, and load the theme you're using in your application.
    2. From the treeview on the left, select the GridDataRowElement / root element /
    3. Then from the panel on the right, set the PositionOffset property to a value of 1,0

    Save the theme, and use it in your application.

    I hope this helps. If you have additional questions, please contact me again.

    All the best,
    Kiril
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Kevin Tran
    Kevin Tran avatar
    40 posts
    Member since:
    Apr 2010

    Posted 14 Jul 2010 Link to this post

    May be for newer version we can make rowindicator visibility as false
  7. Svett
    Admin
    Svett avatar
    728 posts

    Posted 19 Jul 2010 Link to this post

    Hi Kevin Tran,

    This row indicator is shown by default. You can easily turn it off by setting CurrenRowHeaderImage property to null:
    this.radGridView1.TableElement.CurrentRowHeaderImage = null;

    I hope this helps.

    Sincerely yours,
    Svett
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Andrew Shyliuk
    Andrew Shyliuk avatar
    26 posts
    Member since:
    Nov 2009

    Posted 12 Nov 2010 Link to this post

    Hello

    I have a problem with columns hiding in version Q2 2010 SP2. Code that worked in Q1 version doesn't work in current version:

    public static void HideGridColumn(string name, RadGridView grid)
            {
                GridViewDataColumn column = grid.Columns[name];

                if (column != null)
                {
                    column.VisibleInColumnChooser = false;
                    column.AllowHide = true;
                    column.IsVisible = false;
                }
            }

    This is doesn't work. What have I do?

    Best regards,
    Andrew Shyliuk
  9. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 12 Nov 2010 Link to this post

    Hello,

    I have tried your code using the latest version of the RadControls (2010 Q3) which came out yesterday. I tried this by filling a grid with unbound data and invoking your code from a button click. The column was hidden correctly and all worked as expected.

    Could there be an other code that makes the column visible again that you have?
    If not, I'd suggest upgrading to the latest version.
    hope that helps
    Richard
  10. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 17 Nov 2010 Link to this post

    Hi Andrew,

    Like Richard said this code should work when using our latest release - Q3 2010. I recommend that you try this version. If the issue continues to appear, please send us your application and we will investigate the case.

    If you have any other questions, do not hesitate to contact us.

    Kind regards, Jack
    the Telerik team
    See What's New in RadControls for WinForms in Q3 2010 on Wednesday, November 17, 11am Eastern Time: Register here>>
  11. Andrew Shyliuk
    Andrew Shyliuk avatar
    26 posts
    Member since:
    Nov 2009

    Posted 17 Nov 2010 Link to this post

    Hello,

    It works in the new version. Thanks.

    Best regards,
    Andrew Shyliuk
Back to Top
UI for WinForms is Visual Studio 2017 Ready