This is a migrated thread and some comments may be shown as answers.

A way to hide first column?

9 Answers 1279 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ivan
Top achievements
Rank 1
ivan asked on 02 May 2008, 05:47 AM
Hi,
Is there a way to hide the first column in GridView? Or at least to change it to size 0-5?

Thanks

9 Answers, 1 is accepted

Sort by
0
Kiril
Telerik team
answered on 02 May 2008, 08:35 AM
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
0
ivan
Top achievements
Rank 1
answered on 02 May 2008, 11:33 AM
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

0
Kiril
Telerik team
answered on 02 May 2008, 12:46 PM
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
0
Kevin Tran
Top achievements
Rank 1
answered on 14 Jul 2010, 05:07 AM
May be for newer version we can make rowindicator visibility as false
0
Svett
Telerik team
answered on 19 Jul 2010, 03:03 PM
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
0
Andrew Shyliuk
Top achievements
Rank 1
answered on 12 Nov 2010, 12:28 PM
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
0
Richard Slade
Top achievements
Rank 2
answered on 12 Nov 2010, 03:56 PM
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
0
Jack
Telerik team
answered on 17 Nov 2010, 04:44 PM
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>>
0
Andrew Shyliuk
Top achievements
Rank 1
answered on 17 Nov 2010, 04:50 PM
Hello,

It works in the new version. Thanks.

Best regards,
Andrew Shyliuk
Tags
GridView
Asked by
ivan
Top achievements
Rank 1
Answers by
Kiril
Telerik team
ivan
Top achievements
Rank 1
Kevin Tran
Top achievements
Rank 1
Svett
Telerik team
Andrew Shyliuk
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Jack
Telerik team
Share this question
or